Assignee: rogerl → beard
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Internal clock doesn't refresh when system wakes from sleep → JS Date() no longer accurate after system wakes from sleep
The "Preserve memory contents" checkbox only works on certain newer Macs - laptops in particular - and only works if Virtual Memory is on. Basically what it does is save the complete contents of RAM to the VM Storage file before shutting down. When the system wakes from sleep, the data is read from the VM Storage file back into RAM. While asleep with this option, the system doesn't have to keep supplying power to the RAM, so you don't drain your laptop's battery. This only works if the BIOS supports it (so it can wake up), which is why it only works on some Macs. I'm pretty sure that has nothing whatsoever to do with this bug.
NOTE: same problem occurs in the standalone JS shell on my Mac9.1
Status: NEW → ASSIGNED
Changing OS to all, because this problem afflicts all versions of the Mac OS, including Mac OS X. Luckily, the same solution will work in all versions of Mac OS as well.
OS: Mac System 8.5 → All
Created attachment 62067 [details] [diff] [review] Uses Mac OS sleep queue to recompute dstLocalBaseMicroseconds. First attempt at a fix.
Created attachment 62068 [details] [diff] [review] Put inititialization of didReadLocation back. Second attempt.
Attachment #62067 - Attachment is obsolete: true
Comment on attachment 62068 [details] [diff] [review] Put inititialization of didReadLocation back. r=sdagley - looks like my fix in 4.x almost 5 years ago
Attachment #62068 - Flags: review+
Comment on attachment 62068 [details] [diff] [review] Put inititialization of didReadLocation back. sr=sfraser
Attachment #62068 - Flags: superreview+
It occurs to me that the need for MyReadLocation to cache the machine location record is long gone (IIRC it was a problem in the PRAM chip in the IIsi). Consider the user that leaves Mozilla running while travelling across time zones. They'll probably reset their location in the Date & Time CP but we'll miss the change since we inly read the location record once at app startup.
If that's a problem, what about Daylight Savings Time? If I'm in PST (GMT -0800) and suddenly switch to PDT (GMT -0700) while using Mozilla, wouldn't that throw off Mozilla's clock too? This would happen with no action by the user at all.
Yes, the DST info come from the location record as well
Just out of curiousity, what was the problem in the IIsi that needed to be worked around? Do you remember?
If you look closely, you'll see that PRMJ_LocalGMTDifference() is also doing some caching, of the local to GMT zone difference. We clearly need some way to invalidate this caching when the user's time zone has changed. PowerBook sleep is on reason to recheck these values, but crossing from daylight savings time to standard time and vice versa should also invalidate these cached values. What kind of a performance hit might we take if we remove ALL of the caching that's going on in this file?
I'd like to get this checked in today. Let's open another bug to deal with the caching problems.
Done. Bug 115911: Difference from GMT is cached and doesn't refresh when time zone changes
Fix checked in.
Status: ASSIGNED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED
Whiteboard: Needs review
Verified Fixed in standalone JS shell built on Mac9.1, from JS source pulled at 2001-12-18 17:30 PST
Status: RESOLVED → VERIFIED
And Verified Fixed in the browser (trunk binary 20011219xx Mac9.1). Question: do we want to get this fix in the 0.9.7 branch, too? Or is it too risky?
On my IBM Thinkpad With MS Windows XP, I did hibernate, and this problem didn't occur. So it doesn't look cross-platform. Sorry I couldn't test it sooner.
You need to log in before you can comment on or make changes to this bug.