CEMETECH
Leading The Way To The Future
Login [Register]
Username:
Password:
Autologin:

Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 168 users online: 1 member, 129 guests and 38 bots.
Members: Tari.
Bots: VoilaBot (4), Spinn3r (1), Magpie Crawler (3), VoilaBot (12), Googlebot (18).
RSS & Social Media
SAX
You must log in to view the SAX chat widget

Would you want time zone and DST support on a calculator?
No, I can spring forward/fall back manually
0%
 0%  [ 0 ]
Yes, it would be nice, but I can live without it
100%
 100%  [ 5 ]
Yes, and I couldn't live without it!
0%
 0%  [ 0 ]
Other (please leave a comment!)
0%
 0%  [ 0 ]
Total Votes : 5

Author Message
christop


Power User


Joined: 09 Mar 2011
Posts: 385
Location: Arizona, USA

Posted: 22 Nov 2011 12:29:26 am    Post subject: Daylight Saving Time

How important would it be to have time zones and automatic Daylight Saving Time adjustments on a calculator (specifically, for Punix on a TI-89/TI-92+)? I'm trying to find out if it's a desirable feature or just feature creep.

At a minimum, the C library would have to support the TZ environment variable, so it would be only a bit of overhead in userspace library code only. The kernel wouldn't even have to be aware of timezones or Daylight Saving Time or any of that garbage. As far as the kernel is concerned, the system clock is UTC, as all time zone/DST conversions are done in userspace. For example, the filesystem would store all timestamps in UTC, and user programs, such as ls or date, would convert the timestamps to local time simply by using standard C time functions like localtime() or ctime().*

Optionally, the C library could also support zoneinfo database files. Each zoneinfo file is pretty small­—usually 1 or 2 kB, but given the limited space of the calculator, the user would have timezone files only for each timezone he/she resides in. For example, I live in Arizona, so I would have a zoneinfo file only for Arizona/Phoenix on my calculator.

The first option (TZ variable only) is simple but isn't always accurate, and the second option (zoneinfo database files) is more complicated but is far more accurate (historical DST changes can be stored in the databases). Either way, the rules would have to be maintained on the calculator as the dates and times for DST change once in awhile (DST is a political issue, so the changes are not predictable).


On a side note, I was also thinking about supporting leap seconds, and that would best be done in the kernel, but without an accurate time source like NTP, it would be pretty pointless. With the inaccurate clock on the calculator, you would have to set the clock probably a few times a year to keep it within a few seconds of the real time anyway. Then again, I'm also considering adding frequency adjustments (along the lines of adjtimex(2) in Linux) to help reduce clock skew. Smile

Any comments/questions/flames/praises?




* For the curious types (like me), in POSIX systems you can actually specify a timezone directly on the command line like so:

Code:
$ date
Mon Nov 21 22:21:46 MST 2011
$ TZ=WTF+3 date
Tue Nov 22 02:21:54 WTF 2011

"TZ=WTF+3" tells the "date" command (or any other command) that you're in the made-up "WTF" timezone, which is 3 hours west of UTC. You can also specify Daylight Saving Time with the TZ variable:

Code:
$ TZ=WTF+3FTW,J91,J365 date
Tue Nov 22 03:24:39 FTW 2011

That tells "date" that during DST, the timezone is called "FTW" instead of "WTF", and that DST starts on April 1 (Julian day 91) and ends on December 31 (Julian day 365). Since November 22 is between April 1 and December 31, it's DST in the "WTF" timezone, so you're now one hour ahead and in the "FTW" timezone. To set that as the default timezone and DST, all you have to do is export the TZ variable so that all shells see it when you login (perhaps in /etc/profile). (TZ might not be set already in some systems, in which case GNU typically uses the timezone database file at /etc/localtime instead).
_________________
Christopher Williams
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.025665 seconds.