[ntp:questions] [OT] How to get uclibc style timezone string (e.g GMT+0IST-1, M3.5.0/01:00:00, M10.5.0/02:00:00) from javascript

Martin Burnicki martin.burnicki at meinberg.de
Fri Jul 4 07:29:20 UTC 2008


David,

David Woolley wrote:
> Rohit wrote:
[...]
>> Again even if its 
>> correct , its not telling me when (exact date and time )day light
>> saving adjustment starts and ends which is last part of /etc/TZ
>> string, Is there  a way to get this from java script.
> 
> I'm having difficulty thinking of a real world reason why you would want
> to do this.  All the uses I can think of involve shelling out.

The best reason I can think of is to check in advance whether the local time
will swich to and back from DST at the correct points in time, so you won't
get a bad surprise when it doesn't happen.

E.g. when the U.S. rules for DST were changed then users would also have
liked to know whether their OS had already been updated to the new rules
and thus would switch correctly, or not. Unfortunately e.g. under Windows
you can't either check *when* DST would start and end, you could just check
the rules coded in the registry and try to interpret them correctly. 

> Note that this format is a legacy format, and the average Linux system
> (you posted from Linux) has a richer description of the rules.

uclibc is an implementation of the standard C library optimized for embedded
systems, i.e. it does not require as much resources as the "full" standard
C library. I haven't worked with it, though.

The Olson time zone files contain also the history of DST rules, i.e. they
can convert UTC time to local time correctly for years ago. If you just
want some local time for current and future years then the legacy rules may
be sufficient, and using the Olson libs in an embedded system may be
overkill.

If the OP's requirement is to check whether the uclibc functions would
switch to and back from DST at the right points of time then he could write
a little script or program that increments a UTC time stamp e.g. over a
year, let that time be converted to local time and see if the local time
handles DST correctly.


Martin
-- 
Martin Burnicki

Meinberg Funkuhren
Bad Pyrmont
Germany




More information about the questions mailing list