02-13-2013, 06:22 PM | #1 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
KUAL DateTime Button
Set DateTime from Server
All Kindle models have some means to set the system date-time, either manually, automatically, or both. If you are "Blocking Big Brother", you will not be able to reach the Amazon time servers. This button, when added will appear on the KUAL 'Helper' menu list. It will set both the system time (in Linux kernel) and command Linux to set the hardware clock from the user's choice of public time servers. Will work on any Kindle with network access by Wifi, USB cable, or non-Amazon 3G. (Untested on the K2 - but one can hope it works there also.) Will work while the "Block Big Brother" (BBB) firewall is active. The button has a simple configuration file, accessible in USB storage (extensions/helper2/ntpdate.conf) where the user can set from one to four public time servers or time server networks. As shipped, one US time server and three time server networks are configured: NTPD_SERVER='nist.time.nosc.us' NTPD_ALT1='0.uk.pool.ntp.org' NTPD_ALT2='0.europe.pool.ntp.org' NTPD_ALT3='pool.ntp.org' Information on regional and pool server zones can be found here: http://www.pool.ntp.org/zone/@ Information on the US time server network can be found here: http://tf.nist.gov/tf-cgi/servers.cgi Information on the UK time servers can be found here: http://www.timetools.co.uk/ntp-serve...-server-uk.htm The button will produce a "book-report" (actually, a text document) if it encounters any errors. As shipped, the button is configured to also produce the "book-report" when successfully setting the date-time. The configuration file has an option to turn off the "Success book-report", the default is to produce the success report. The success report is enabled by setting the configuration file to: NTPD_REPORT='true' The success report can be disabled by setting the configuration file to: NTPD_REPORT='' BIG NOTE: When dragging or copying an update to this button into the extensions directory, it will over-write your modified ntpdate.config file. Not tragic, unless you had to change the time server list. The configuration file is actually a fragment of a script, it **must** use Linux line-endings. Installation:
Finding the 'book-report' Since the book-report is actually a text file, your kindle will consider it a 'doc' rather than a 'book'. If you have a display filter on your Kindle ('My Items' dropdown thing), then set it to either 'all items' or 'docs' to see the DateTime book-report. The attachments here have a *.json file that does not work with the version-2 series of the kual launcher. The corrected *.json file can be found in the new repository, at this link: Sources: http://hg.minimodding.com/repos/sys/kBBB.hg/summary New Repo at: https://bitbucket.org/knc1/kualettes...ate?at=default Changes: 1.0.1 - try to compensate for slow DNS resolvers and fix the problems with Kindles not showing the most recent report document. Last edited by knc1; 08-23-2013 at 09:41 AM. |
02-13-2013, 07:53 PM | #2 |
Member
Posts: 12
Karma: 28820
Join Date: Dec 2011
Device: Kindle Touch
|
@knc1
Your helper2-1.0.0.zip seems to be missing the bin/ntpdate.sh file (it is in helper2-1.0.0.tar.gz though) |
Advert | |
|
02-13-2013, 08:00 PM | #3 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Thanks, FIXED
Last edited by knc1; 02-13-2013 at 08:05 PM. |
02-14-2013, 10:04 AM | #4 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Kpw Drift
I have noticed that with my Kpw asleep for 12 hours, the time base will have drifted nearly 0.1 of a second (reported as: 'offset: ' in the book-report when re-setting).
So a "tap a day" should be enough to keep the file time-date stamps consistent. At least if my Kpw is representative of sleeping Kindles. |
02-14-2013, 10:45 AM | #5 | |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Quote:
The DX often wanders by many hours sporadically and then plays catch up on 3g "connect", this is of course a known, other, phenomenon, but I was short of things to talk about and it was not entirely uninteresting and vaguely related Thanks for the metric on slippage. perhaps I should leave one in a coma for a week or so and see what the slip is like. But, as you say: With the new shiny "Make it So" button "Who cares?" Last edited by twobob; 02-14-2013 at 10:45 AM. Reason: s/would/should/ |
|
Advert | |
|
02-14-2013, 12:03 PM | #6 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
On your DX - -
Log in to 3G so that they system time is correctly set - Steal the one-liner 'hardware clock set from system time' command out of the DateTime script, run that on the DX. I suspect that the sporadic jumps in time is caused by the kernel re-reading an improperly set hardware clock. |
02-15-2013, 01:58 PM | #7 |
Wizard
Posts: 4,759
Karma: 246906703
Join Date: Dec 2011
Location: USA
Device: Oasis 3, Oasis 2, PW3, PW1, KT
|
In your ntpdate.sh, after moving the logfile to /mnt/us/documents/ntpdate.txt, why not opening that file so you can look at it? Like this (in red) in ntpdate.sh:
Code:
****snipsnip****
if [ x$RPT == 'xtrue' ]
then
mv $LOG /mnt/us/documents/ntpdate.txt
dbus-send --system /default com.lab126.powerd.resuming int32:1
lipc-set-prop com.lab126.appmgrd start \
app://com.lab126.booklet.reader/mnt/us/documents/ntpdate.txt
else
rm $LOG
fi
exit 0
lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.reader/mnt/us/opt/log/ntpdate.txt (not sure if that works in the menu.json directly, or if you have to wrap it around another shell script) This works fine by editing menu.json to: Code:
{ "items": [ { "name": "Helper", "priority": 0, "items": [ {"name": "Set DateTime from Server", "priority": 1, "action": "bin/ntpdate.sh"}, {"name": "Show DateTime log", "priority":1, "action": "lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.reader/mnt/us/documents/ntpdate.txt"} ] } ] } Last edited by DuckieTigger; 02-15-2013 at 02:10 PM. Reason: added menu.json support |
02-15-2013, 02:18 PM | #8 | |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
But I was assuming that people would do one of two things: 1) Read it and keep it (somewhere) for a "most recently set" record. 2) Just delete it. And now with four time server addresses (ntpdate uses all that it can reach of the four, and then computes the 'best' of those) - - And the last one of those the 'global' pool - - The button should succeed more often that not. (a lot more often) Anywhere in the world. Once the end-user has acquired some confidence that the button works in their location - - Then they can decide if they want the success record or not. If they disable the success record, then the only time a report will be made is on a failure of some sort. So far - we have had only a couple of dozen downloads - and only one report on if the button works (from twobob). But still that is a thought to keep in mind. Just need a bit bigger sample of user opinions now. PS: Yes, any single line (including multiple statements) shell command will work in the "action" : field of menu.json . |
|
02-15-2013, 02:28 PM | #9 | |
Wizard
Posts: 4,759
Karma: 246906703
Join Date: Dec 2011
Location: USA
Device: Oasis 3, Oasis 2, PW3, PW1, KT
|
Quote:
And also thank you for the idea - did not know how to start the reader with a script (searched that just to answer) - great way to e.g. create any output in /tmp, display it, and let the Kindle worry about when to delete the /tmp folder to make room. (I do hope it does that ) |
|
02-15-2013, 02:34 PM | #10 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Ah, I never leave it behind in /var/tmp -
It is either moved or removed. A view last setting helper button? Should be a one-liner in the menu.json file. But it would mean moving it somewhere other than documents. And since I don't use any of the "Collection Management" stuff - I don't know how this will react if someone has put the success report into a "Collection" of reports. What I really need at this point is more than 2 dozen silent users. |
02-15-2013, 02:41 PM | #11 | |
Wizard
Posts: 4,759
Karma: 246906703
Join Date: Dec 2011
Location: USA
Device: Oasis 3, Oasis 2, PW3, PW1, KT
|
Quote:
|
|
02-15-2013, 03:12 PM | #12 | |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
Then updated the date-time. Then looked at the ntpdate report (which remained in the collection: "Reports" after its update). A strange thing happened - The first time I looked at it, it still showed the old information. But on the second and subsequent looks, it showed the new information. The system must be caching the document somewhere and just taking a little while (seconds) to clear the cache of outdated material. I haven't tried the same with ixtab's Collection Manager. Will leave that to someone with time on their hands. |
|
02-15-2013, 04:06 PM | #13 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Yeah. I suspect you are 100% correct. but where. who knows
|
02-17-2013, 03:57 PM | #14 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
|
08-28-2013, 07:00 PM | #15 |
Addict
Posts: 250
Karma: 136662
Join Date: Apr 2011
Device: N/A
|
Can the time-zone of the Kindle be changed programatically? This would be a nice plus for this DateTime button.
Also, related: - command 'date' on Kindle shows GMT+12:22100 as time-zone; - command 'date -u' shows UTC as time-zone; - the delta=12:22 of the time-zone is consistent to /var/local/system/tzVar, which I updated, and to /var/local/java/prefs/com.amazon.ebook.framework/prefs entries device.tz.ltosec and device.tz.lasttz, which I edited and rebooted. Now, the DateTime button behaves correctly, i.e. with respect to my time-zone, not to the strange 12:22 time zone. But the date command still behaves strangely. Why is that? Later edit: as soon as I enter plane-mode again, the local time is messed up again. I honestly cannot understand this behaviour. Can someone explain this? Last edited by hfpop; 08-28-2013 at 07:59 PM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A helpful list of Extensions for KUAL | twobob | Kindle Developer's Corner | 137 | 09-19-2024 05:37 PM |
KUAL: Kindle Unified Application Launcher (v2.7) | twobob | Kindle Developer's Corner | 2318 | 08-14-2024 07:54 PM |
[KUAL] Button Def. Packages (SUPERSEDED) | knc1 | Kindle Developer's Corner | 6 | 09-27-2013 07:56 PM |
Working with DateTime custom columns programmatically? | kiwidude | Development | 13 | 12-15-2011 11:09 AM |
Datetime error uploading to iPad | wechap | Calibre | 3 | 06-29-2010 07:21 AM |