MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Kindle Developer's Corner (https://www.mobileread.com/forums/forumdisplay.php?f=150)
-   -   "date" reports correct time zone and time; UI reports a time several hours off (https://www.mobileread.com/forums/showthread.php?t=217760)

Synthead 07-10-2013 07:47 PM

"date" reports correct time zone and time; UI reports a time several hours off
 
I pushed a file from /usr/share/zoneinfo to my kindle's /var/local/system/tz file. It shows the time zone I want when I run "date" on it, but the Kindle's time (in the UI) is several hours off. What's wrong?

For the record, this Kindle is not registered to Amazon.

knc1 07-10-2013 07:56 PM

Quote:

Originally Posted by Synthead (Post 2565850)
I pushed a file from /usr/share/zoneinfo to my kindle's /var/local/system/tz file. It shows the time zone I want when I run "date" on it, but the Kindle's time (in the UI) is several hours off. What's wrong?

For the record, this Kindle is not registered to Amazon.

Set BOTH the system time and the hardware clock.
Both set to the same (GMT) time.

?? Is the "several hours off" happen to be your offset from TZ-0?

Synthead 07-10-2013 08:20 PM

Quote:

Originally Posted by knc1 (Post 2565855)
Set BOTH the system time and the hardware clock.
Both set to the same (GMT) time.

?? Is the "several hours off" happen to be your offset from TZ-0?

I'll give an example. From my Linux machine, I push my Los_Angeles (PDT) zoneinfo file to /var/local/system/tz:
Code:

$ scp America/Los_Angeles kindle:/var/local/system/tz
Los_Angeles                                                                      100% 2819    2.8KB/s  00:00

On my Kindle, I run ntpdate to sync the time:
Code:

# ntpdate pool.ntp.org
10 Jul 16:16:26 ntpdate[8386]: step time server 74.120.8.2 offset 25966.135014 sec

I check the date on the Kindle:
Code:

# date
Wed Jul 10 16:17:56 PDT 2013

The time and time zone is correct. On the Kindle UI, I press the Menu button, and it reports 11:17 PM instead of the 4:17 PM on the system time. If I write the current time to the hardware clock (hwclock -w), the time in the UI remains the same.

knc1 07-10-2013 08:38 PM

And after you do a re-start? (Which should not be required)

And my earlier question - how many hours off is that time displayed in the UI?

NiLuJe 07-10-2013 09:07 PM

Yeah, it gets tricky sometimes.

Cf. /usr/sbin/setdate && /usr/sbin/settz && /usr/sbin/updatetime

The K5 ;st shortcut calls setdate with the wanted time in the %s format. (use date -D "inputfmt" +outputfmt "time" to convert, or use the output of a full fledged date from a proper Linux system).

farfeduc 07-11-2013 08:40 AM

Same problem here : Paperwhite not keeping Time

The problem has already been covered.

Synthead 07-11-2013 06:04 PM

Quote:

Originally Posted by NiLuJe (Post 2565926)
Yeah, it gets tricky sometimes.

Cf. /usr/sbin/setdate && /usr/sbin/settz && /usr/sbin/updatetime

The K5 ;st shortcut calls setdate with the wanted time in the %s format. (use date -D "inputfmt" +outputfmt "time" to convert, or use the output of a full fledged date from a proper Linux system).

I want to set the date via NTP with a correct zoneinfo file :p I could fidget with "date -s MMDDhhmm[[CC]YY][.ss]", but that just feels gross working as a sysadmin :p

Quote:

Originally Posted by farfeduc (Post 2566284)
Same problem here : Paperwhite not keeping Time

The problem has already been covered.

I don't want to register the Kindle with Amazon.

NiLuJe 07-11-2013 06:08 PM

/usr/sbin/updatetime is Amazon's wrapper around ntp, IIRC.

knc1 07-11-2013 07:19 PM

Quote:

Originally Posted by Synthead (Post 2566754)
I want to set the date via NTP with a correct zoneinfo file :p I could fidget with "date -s MMDDhhmm[[CC]YY][.ss]", but that just feels gross working as a sysadmin :p



I don't want to register the Kindle with Amazon.

Install the KUAL.ntpdate button.
Change the time server(s) or time server network(s) as desired per the directions.

knc1 07-11-2013 07:22 PM

Quote:

Originally Posted by Synthead (Post 2565869)
Code:

# ntpdate pool.ntp.org
10 Jul 16:16:26 ntpdate[8386]: step time server 74.120.8.2 offset 25966.135014 sec

I check the date on the Kindle:
Code:

# date
Wed Jul 10 16:17:56 PDT 2013

The time and time zone is correct. On the Kindle UI, I press the Menu button, and it reports 11:17 PM instead of the 4:17 PM on the system time. If I write the current time to the hardware clock (hwclock -w), the time in the UI remains the same.

Right ! Your off by the gmt offset in the two readings.
Being a sysadmin, you can probably fix that better than we could. ;)

ixtab 07-11-2013 07:34 PM

... this method has always worked for me:
https://wiki.mobileread.com/wiki/Kind..._the_time_zone

Synthead 07-11-2013 07:38 PM

Quote:

Originally Posted by ixtab (Post 2566814)
... this method has always worked for me:
https://wiki.mobileread.com/wiki/Kind..._the_time_zone

That's what I mentioned in my original post. The time is still incorrect on the Kindle's UI.

ixtab 07-11-2013 08:11 PM

Quote:

Originally Posted by Synthead (Post 2566817)
That's what I mentioned in my original post. The time is still incorrect on the Kindle's UI.

Try rebooting your Kindle. And maybe try symlinking the /etc/localtime file directly to the timezone file, instead of indirectly via /var/local/system/tz.

I just tried it again on a Kindle Touch, and it worked again as expected (but only after a reboot, not immediately via SSH - not even if restarting the framework).

EDIT: Yep... you're right. Even after setting up everything correctly, the K4 will simply stick to displaying UTC in the user interface. I guess "inability to show the correct timezone" is just one more thing to complain about to Amazon CS. I'm personally not terribly surprised.

knc1 07-12-2013 09:51 AM

Ah, phooey.
Lab126 forgot the -u option use in their testing and/or scripting.
And that crew **gets paid** to turn out this stuff!

@ixtab: Any chance that Java is somewhere maintaining its own idea of the date/time/tz without reference to the system/hardware clocks?
I.E: A module that should only be used on systems that do not have hardware date/time?

Hmm...
I guess I could re-write the ntpdate button to store local time in the hardware of the K4.
But that seems kind of like a kludge to me.

ixtab 07-12-2013 10:30 AM

Quote:

Originally Posted by knc1 (Post 2567274)

@ixtab: Any chance that Java is somewhere maintaining its own idea of the date/time/tz without reference to the system/hardware clocks?
I.E: A module that should only be used on systems that do not have hardware date/time?

Nothing specific that I'd know of. But (even without being able to provide exact code), something like "get current time, and display it as Zulu time" should be straightforward to code.

It doesn't really make sense, but it's seemingly what they did. Maybe because they didn't even ship the files required to support time zones in the first place, so they assumed the only "existing" TZ would be UTC anyway?

"Who needs more than one timezone anyway? Or, for that matter, who needs the correct date and time on an e-book reader?"

:smack:


All times are GMT -4. The time now is 07:06 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.