1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-25 09:47:17 +00:00

os/date: allow negative timestamps.

Why not?  Even on 32-bit time_t systems this lasts until late 1901.
This commit is contained in:
Leah Neukirchen 2020-03-18 19:50:26 +01:00
parent f013c6e48d
commit efdb13f0c7

View File

@ -621,8 +621,6 @@ static Janet os_date(int32_t argc, Janet *argv) {
struct tm *t_info = NULL; struct tm *t_info = NULL;
if (argc) { if (argc) {
int64_t integer = janet_getinteger64(argv, 0); int64_t integer = janet_getinteger64(argv, 0);
if (integer < 0)
janet_panicf("expected non-negative 64 bit signed integer, got %v", argv[0]);
t = (time_t) integer; t = (time_t) integer;
} else { } else {
time(&t); time(&t);