- fixed date->time-utc to honor the zone-offset field when converting a date

object to a time-utc object.
    stats.c,
    date.ms

original commit: 63a97939896c2a89fcffdf16c8b783efaeb816b5
This commit is contained in:
Andy Keep 2016-04-29 00:43:06 -04:00
parent ed1a4da9a1
commit cfe66a259b
4 changed files with 13 additions and 0 deletions

3
.gitignore vendored
View File

@ -12,3 +12,6 @@
/ti3nt/
/ti3osx/
Makefile
.*.sw?
.sw?
bin

4
LOG
View File

@ -55,3 +55,7 @@
- fixed time-utc->date test in mat time&date-printing to work regardless of
what locale (and time zone) the host machine has set.
date.ms
- fixed date->time-utc to honor the zone-offset field when converting a date
object to a time-utc object.
stats.c,
date.ms

View File

@ -375,6 +375,7 @@ ptr S_asctime(ptr dtvec) {
ptr S_mktime(ptr dtvec) {
time_t tx;
struct tm tmx;
long orig_tzoff = (long)UNFIX(INITVECTIT(dtvec, dtvec_tzoff));
tmx.tm_sec = (int)Sinteger_value(Svector_ref(dtvec, dtvec_sec));
tmx.tm_min = (int)Sinteger_value(Svector_ref(dtvec, dtvec_min));
@ -405,6 +406,7 @@ ptr S_mktime(ptr dtvec) {
INITVECTIT(dtvec, dtvec_year) = Sinteger(tmx.tm_year);
INITVECTIT(dtvec, dtvec_wday) = Sinteger(tmx.tm_wday);
INITVECTIT(dtvec, dtvec_yday) = Sinteger(tmx.tm_yday);
if (tmx.tm_gmtoff != orig_tzoff) tx = difftime(tx, (time_t)(orig_tzoff - tmx.tm_gmtoff));
return Scons(S_integer_time_t(tx), Svector_ref(dtvec, dtvec_nsec));
}

View File

@ -556,6 +556,10 @@
(let ([t (current-time 'time-utc)])
(sleep (make-time 'time-duration 0 1))
(time<? t (date->time-utc (current-date))))
(let ([t (current-time)])
(time=?
(date->time-utc (time-utc->date t -14400))
(date->time-utc (time-utc->date t 0))))
)
(mat time&date-printing