Open ocyzl opened 4 years ago
From the same section of the Chez Scheme User's Guide:
A time-zone offset represents the time-zone offset, in seconds, from UTC. It is an exact integer in the range -86400 to +86400, inclusive. For example, Eastern Standard Time (EST), which is 5 hours east, has offset 5 × 3600 = -18000.
The last sentence should instead be:
For example, Eastern Standard Time (EST), which is 5 hours west, has offset -5 × 3600 = -18000.
In the description of date-year-day
:
A year-day is an exact nonnegative integer less than 367, where 0 represents the first day of the year (January 1), 1 the second day, 2 the third, and so on.
I think "less than 367" should be "less than 366". If days start at 0, the last day of the year is 365 in a leap year, and 364 otherwise.
Thanks for the comments, we should improve the documentation on this.
As far as the bug, unfortunately we are relying on the functionality provided by the underlying mktime
implementation from the C library, and it appears in this instance it is unaware of the leap seconds.
http://cisco.github.io/ChezScheme/csug9.5/system.html#./system:h10 says about dates:
Nanosecond has to be nonnegative too, right?
I don't think they ever add two leap seconds in one day. (They did once add two in one year, in June and December 1972.) Also, seconds start from 0, so the last second of a minute is usually 59, and a leap second is 60, not 61.
Likewise, 62 should be 61 in the description of
make-date
:Also in
make-date
, there's a missing "and" in:Here's what happens when I try to use a second of 59, 60, 61, and 62:
59 works, as expected. 61 and 62 don't work, as expected, but give different errors for some reason. 60 doesn't work, but I think it should, because a leap second was in fact added at the end of December 2016.