Daniel Berenguer wrote:
How could my application know whether a given date (current date for
instance) is within the daylight saving period or not?
I ask this because "date -s" and "settimeofday" don't take DST into
account so my app should correct the user date prior to execute the
above commands.
At this moment I'm thinking in parsing /etc/TZ. Any other idea?
Thanks,
Daniel.
If you're using an /etc/TZ file to define your timezone you should be
able to just use UTC/GMT to set your date and time and uClinux should
then be able to correct it for your locale, no knowledge of DST needed.
"date -u ..." supports this. Also once you have a corrected TZ file just
supply the normal date/time with "date MMDDhhmm[[CC]YY][.ss]" to set it
and uClinux can figure out if you mean DST or not.
If you're suffering from the same random act of US Congress as I was,
you can get uClinux to handle this for you by putting the appropriate
corrected values in /etc/TZ.
Add this to your /etc/TZ file:
-ST--DT,M3.2.0,M11.1.0
Replace '-' with locale appropriate to your timezone, i.e.:
EST5EDT,M3.2.0,M11.1.0 # US Eastern Time Zone
CST6CDT,M3.2.0,M11.1.0 # US Central Time Zone
MST7MDT,M3.2.0,M11.1.0 # US Mountain Time Zone
PST8PDT,M3.2.0,M11.1.0 # US Pacific Time Zone, etc.
The 'M' syntax is day & week relative to the beginning of a month.
Ergo:
M3.2.0 means the 2nd Sunday in March where Sunday is the weekday
represented by the final .0
M11.1.0 means the 1st Sunday in November.
There is a time specifier as well, if you leave it off it defaults
to 02:00:00. To use it would look like this:
EST5EDT,M3.2.0/02:00:00,M11.1.0/02:00:00 # US Eastern Time Zone (at 2AM)
Found via this link:
http://www.linuxselfhelp.com/gnu/glibc/html_chapter/libc_21.html#SEC440
See the section titled "Specifying the Time Zone with TZ"
Dave
--
David Spain
SiCortex, Inc.
Three Clock Tower Place, Suite 210
Maynard, MA USA 01754 Email: [EMAIL PROTECTED]
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev