detecting DST change

Post Reply
Posts: 40
Joined: Wed Feb 06, 2008 3:45 pm

detecting DST change

Post by nduvnjak »

this simple code in Vortex:
<$NOW=(convert( 'now', 'date'))>
<fmt '%Y-%m-%d %H:%M:%S %Z' $NOW>

is supposed to display current system date/time, right?
Well, I wanted to test some date arithmetics and how it performs during the DST-switch, so I changed the system time on purpose. The platform is Linux (VM) CentOS 6.8
System time successfully changed to :
2018-11-04 01:58:00 EDT
in other words, just minutes before the clock was supposed to turn back one hour.
If at that time, I run the linux command: date, I get:
Sun Nov 4 01:58:01 EDT 2018
, as expected. Then I run above script, and I get:
2018-11-04 01:58:52 EDT
which is also expected, and more important - equal to the system time.
(difference in seconds is because I'm running the tests while I'm writing this)
So after a few minutes, the DST-switch occurs, when I try "date" again on Linux, I get:
Sun Nov 4 01:00:26 EST 2018
important to notice: time switched back 1 hour, and EDT changed to EST. - all expected.
But, when I run my script, I get:
2018-11-04 01:01:18 EDT
as if Texis mixed up something. It shows the "correct" time, but in wrong time zone. As if it was able to read the changed system time correctly, but it still thinks it's EDT.
This of course messes up the date arithmetics, which is another part of the program that I don't share here, in order not to complicate too much, especially when I think I pinpointed the real problem - and that is that Texis thinks it's still EDT.

Furthermore, when I let the time pass and the system time reaches 2 am (in EST), it's only then when Texis comes back to reason, and is able to recognize and display exact system time, including the time zone.
My original test was with actual waiting for 1 more hour to expire, but this time I will fast-forward and set the system time to:
sudo date --set "20181104 01:58:00 EST"
at this point Texis still show:
2018-11-04 01:58:24 EDT
, but just after a few minutes...

$ date
Sun Nov 4 02:00:07 EST 2018
$ texis quicktestcheckdate
2018-11-04 02:00:11 EST

finally the correct time, identical to system's, including the time zone.

any thoughts?


forgot to mention, Texis version:
Commercial Version 7.03.1434477553 20150616 (x86_64-unknown-linux2.6.9-64-64)
User avatar
Site Admin
Posts: 1272
Joined: Tue Apr 25, 2000 1:27 pm

detecting DST change

Post by Kai »

This is a bug that was fixed last year (release 20171117 and later): parsed times like `now', `+10 minutes' etc. could be off by an hour (or more) during or near the DST-to-STD or STD-to-DST transition time. The printed timezone is actually correct for the printed time; it's just that the printed time is 1 hour off from system time: print the raw $NOW integer compared to `date +%s' and you'll see a 3600 second diff.

Contact sales for an upgrade (if you have maintenance and don't already have that release or newer).
Post Reply