[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: os.time() vs. isdst
- From: Alexander Gladysh <agladysh@...>
- Date: Wed, 6 Apr 2011 05:31:13 +0400
Hi, list!
In Lua 5.1 and 5.2 time table `isdst` field is boolean.
But actually, in its C counterpart, `struct tm`, `tm_isdst` it is a
tribool. Quoting `man gmtime` (did not check C89 standard sorry):
`tm_isdst` A flag that indicates whether daylight saving time is in
effect at the time described. The value is positive if daylight
saving time is in effect, zero if it is not, and negative if the
information is not available.
Now, I've hit a nasty issue[1] when I *must* use negative `isdst`
value. I do not hope that there is a way to workaround this for stock
`os.date()`, so I have to roll out my own C module for 5.1.
But maybe it is not too late to change this in 5.2?
Alexander.
[1] — http://stackoverflow.com/questions/5559294/dst-switch-aware-getter-for-unix-timestamp-of-current-days-local-time-midnight/5560261#5560261