WizardStan
Mega GP Mania
- Joined
- May 24, 2008
- Messages
- 16,731
I can suggest it.
3) In the unmodified state of op_power.sh the TZ loss happens not at wake-from-standby but after-bootup! I dunno the init process on the Pandora. Some-one who knows, please investigate where the HW clock looses its UTC zone association and changes to local.
Someone, who knows the bootup process, please investigate where the TZ loss happens in this process.The bootup is completely different from the wakeup process.
This works a treat for me. How come it's not there by default?Open the file "/usr/pandora/scripts/op_power.sh" with your preferred editor as super user (ie, "sudo vi ..." or "sudo mousepad ...")
At line 219, insert "hwclock -s", such that it reads
fi
hwclock -s
display_on
Time drift disappears.
Ah I see.from what I've witnessed so far the HW clock does not tick on correctly when the system is in suspend.
according to "hwclock" the time is now "Tue Oct 15 12:04:42 2013" while in actual time it is already October the 17th.
I have the Pandora for little more than a month now and the battery never went out of juice.
It was not until ~2 weeks ago (when I learnt about the suspend mode (flick power switch)) that I started to experience time drift (before that I simply closed the lid .. bad idea for battery life).
"hwclock -s" is no solution here since that one simply sets the system time to the hardware clock.
Are you sure you haven't rebooted? This is the problem I've had numerous times: when it goes through a reboot for any reason, the hardware clock is set to the system time. The system clock tends to drift when suspended, and then if a reboot happens that drifted time gets set to the hardware clock. Hence why I added the "hwclock -s" which ensures the hardware clock (which I've never seen drift on its own) gets pushed to the system clock. Trip and I aren't the only two who have solved our drift problems with the hwclock fix, either; you're the first person to say it doesn't work for them.according to "hwclock" the time is now "Tue Oct 15 12:04:42 2013" while in actual time it is already October the 17th.
interesting, I'd have expected that during reboot, the system time is set to the hw clock !?when it goes through a reboot for any reason, the hardware clock is set to the system time
ok, that might explain it then. During the past month I rebooted quite a lot of times (often involuntarily)The system clock tends to drift when suspended, and then if a reboot happens that drifted time gets set to the hardware clock
had to do that a couple of times. along with what WizardStan said, this probably explains the "extreme" time drift on my Pandora.Just a random aside. I've noticed that if I ever have to do a hard reset of the pandora (pandora button and flip the power switch or remove the pandora battery) when the pandora is in some sort of state that is locked or something similar, that the current date & time will be set back to when the pandora was first turned on in that session.
So, if you had to do anything like that, that will though the time way off.
I just took a quick look -- the bootscripts seem to be ok.I think I saw some messing with clocks in some boot script, I can remove that if it helps.
that's probably not a bad idea. I'll try that (added a new line "hwclock -s" after line 278 in op_power.sh, let's see how that works out)The simplest fix is to load the hardware clock back to system when it resumes, optionally saving the system clock to the hardware clock when it goes into suspend.
Yes, actually. The TWL chip (which is responsible for the charging, the clock, the power control, bunch of other stuff) has a wake-on-alarm feature: when set it will trigger the same interrupt it gets when you flip the power switch or insert the power cable: ie, it will turn on Check /sys/class/rtc/rtc0/wakealarmah, on the topic of time (in general): I recently wondered whether there is any way to make the Pandora auto-resume at a certain alarm time. I'd like to use it as a glorified alarm clock
sudo su
echo 1382025600 > /sys/class/rtc/rtc0/wakealarm
*power off*
*Turns on at 16:00*
. ./test_alarm.sh