ashinn / chibi-scheme

Official chibi-scheme repository
Other
1.21k stars 141 forks source link

`(chibi time)`'s `time-year` is off by 1900? #852

Closed ghost closed 2 years ago

ghost commented 2 years ago

I just wrote some code with (chibi time), and the following line produced an unexpected result:

> (time-year (seconds->time (timeval-seconds (car (get-time-of-day)))))
122

Apparently, years are counted from 1900?

The rest of the time-@ procedures are do what I expect them to do.

ashinn commented 2 years ago

This is WAI, time is a direct interface to struct tm, and as such is a low-level API.

Use SRFI 19 or (chibi chrono) for a high-level API (https://github.com/ashinn/alschemist/blob/master/chibi/chrono.sld).