On 2008-07-17 22:51+0100 Andrew Ross wrote:

> Actually, while checking the various languages I found a problem with my
> approach. Obviously my linux system is missing daylight saving
> information for 1970. Calling
>
> t1 = 0;
> tm = *gmtime(&t1);
> t2 = mktime(&tm);
> toff = (PLFLT) difftime(t1,t2);

>
> returns 3600 for toff at the moment, and not 0 as it should (I'm in the
> UK). There should be no daylight savings for 1st January so the local
> time is equivalent to UTC.

toff was -28800 (- 8 hours) here which makes sense since in January 1970
(any winter, for that matter unless the politicians really get crazy) my
local time is 8 hours less than Greenwich time.  So, Andrew, I agree with
your conclusion that you have a locale bug (missing information about 1970)
for the particular platform you were trying.

You might want to print out toff on additional platforms to see whether that
locale bug is common or not.

Also, what happens if you specify t1 for January for a range of years from
1900 to 2008?  It would be interesting if toff were non-zero only for 1970.

Our local LUG had a report from one of its members recently that the date
command was giving him screwy results for the last second in 1969.  (He
happened to be making a table of date results for the last second of every
year since 1900.) It turned out he had an old CENTOS distro with some
time/locale issue and everybody else (including those with more modern CENTOS)
got the right answer (-1).

So it is quite possible you have found a time/locale bug specific to your
particular platform.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to