Commit Graph

5 Commits

Author SHA1 Message Date
Stephen Heumann
44dfc1d1d6 Prevent localtime() from potentially giving incorrect tm_isdst values.
This could happen when it was called for a time other than the present, because it set tm_isdst based on the current value of the DST flag in BRAM, which is valid only for the current time.

Now it works as follows: If localtime() is passed the time_t value that was produced by the most recent call to time(), it gives the DST setting in effect at the time of that call.  Otherwise, it sets tm_isdst to -1, indicating that the correct value is unknown.

This is about the best we can do without having a full timezone library/database. It should give the right tm_isdst value in probably the most common case, and avoids giving an incorrect value in any case (assuming the system's DST flag is right).

This fixes #18.
2020-02-02 12:52:42 -06:00
Stephen Heumann
21d34a30ce mktime: tm_yday should be indexed from 0 for January 1st, not 1.
This fixes the libca07.c test case.
2018-03-09 17:38:55 -06:00
Stephen Heumann
a77e44d7b5 Fix asctime() to properly print years 1000 through 9999.
Also, use a leading space rather than a leading 0 in days 1 through 9.

This fixes the libca11.c test case.
2018-03-09 13:10:53 -06:00
Kelvin Sherlock
578bda8439 CR -> LF 2017-10-31 13:14:07 -04:00
mikew50
954c3a02b5 ORCA libraries, from the Opus ][ CD 2017-10-01 18:00:58 -06:00