After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 521680 - daylight savings problem with date:seconds()
daylight savings problem with date:seconds()
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
1.1.22
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2008-03-10 22:14 UTC by Peter Pawlowski
Modified: 2008-04-08 19:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test showing the incorrect behavior (1.46 KB, text/plain)
2008-03-10 22:19 UTC, Peter Pawlowski
  Details
patch (1.60 KB, patch)
2008-03-10 22:22 UTC, Peter Pawlowski
none Details | Review
corrected patch (3.15 KB, patch)
2008-04-03 13:43 UTC, Peter Pawlowski
none Details | Review

Description Peter Pawlowski 2008-03-10 22:14:41 UTC
Please describe the problem:
During daylight savings time and during the crossovers into and out of daylight savings, date:seconds() reports the incorrect value.

Steps to reproduce:
1. Set your computer's clock to 2008-03-09 03:11:00
2. Run date:seconds and view the value: 1205050260


Actual results:
the value of date:seconds is 1205050260


Expected results:
the value of date:seconds should be 1205046660, as reported by:

date +%s

Does this happen every time?


Other information:
Comment 1 Peter Pawlowski 2008-03-10 22:19:49 UTC
Created attachment 107017 [details]
test showing the incorrect behavior

Use this script to test your version of xsltproc. It will change the clock on your machine!

The only command line argument is a path to the xsltproc binary to test.

Here is what the output should look like with the current code:

testbed1:~/peter-testing # ./time-test ./xsltproc
Shutting down network time protocol daemon (NTPD)                     done
test 1 FAILURE: 1155661200 1155657600 (date was 2006-08-15 12:00:00)
test 2a FAILURE: 1162101720 1162098120 (date was 2006-10-29 01:02:00)
test 2b success: 1162105320
test 2c success: 1162108920
test 3 success: 1167411720
test 4a success: 1173586320
test 4b success: 1173592740
test 4c success: 1173595680
test 4c FAILURE: 1173600720 1173597120 (date was 2007-03-11 03:12:00)
test 5 FAILURE: 1184126400 1184122800 (date was 2007-07-10 23:00:00)
test 6a FAILURE: 1194156660 1194153060 (date was 2007-11-04 01:11:00)
test 6b success: 1194167460
test 7 success: 1199437860
test 8a success: 1205039460
test 8b success: 1205043060
test 8c FAILURE: 1205050260 1205046660 (date was 2008-03-09 03:11:00)
Starting network time protocol daemon (NTPD)                          done
Comment 2 Peter Pawlowski 2008-03-10 22:22:39 UTC
Created attachment 107018 [details] [review]
patch

This patch fixes the problem. It calculates the timezone offset from GMT manually, by comparing each field between the local tm struct and the gm tm struct.
Comment 3 Daniel Veillard 2008-04-03 05:35:16 UTC
Okay, this looks sane, and makes sense, 

  thanks a lot for the report and the patch, applied
and commited to SVN,

Daniel
Comment 4 Peter Pawlowski 2008-04-03 13:43:44 UTC
Created attachment 108545 [details] [review]
corrected patch

Daniel -- oops, I forgot to attach an updated patch that fixes an error I made in the patch I had attached before. I didn't properly copy the time structures to handle non-reentrant versions of the time functions. This is the correct patch.

Peter
Comment 5 Daniel Veillard 2008-04-08 19:23:44 UTC
Okay, I applied the corrected patch just before the 1.1.23 release,

 thanks,

Daniel