From 84ced681a24c5ea7223f8f33554eb42266baab60 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 29 Mar 2022 19:10:44 -0400 Subject: datetime: Drop newly unused use of timegm() It's non-standard. --- diff --git a/TODO b/TODO index 0a038a3..2089ee9 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ -drop timegm() try to fix dst bug test with other libc's (newlib? musl? fbsd? obsd?) `./@ 7:00 PM` doesn't work with musl strptime() diff --git a/configure.ac b/configure.ac index 133e8ee..40a3205 100644 --- a/configure.ac +++ b/configure.ac @@ -42,7 +42,7 @@ AC_CHECK_FUNCS( [\ calloc difftime fprintf fputs free isspace localtime mktime \ printf realloc setvbuf sleep strerror strlen strftime strptime \ - time timegm + time ], [], [funcs_missing=true]) diff --git a/src/datetime.c b/src/datetime.c index 2c971a4..0bba344 100644 --- a/src/datetime.c +++ b/src/datetime.c @@ -33,18 +33,6 @@ #include "datetime.h" #include "formats.h" -static struct tm DATETIME_EPOCH_ = { - .tm_sec = 0, - .tm_min = 0, - .tm_hour = 0, - .tm_mday = 1, - .tm_mon = 0, - .tm_year = 70, - .tm_wday = 4, - .tm_yday = 0, - .tm_isdst = -1, -}; - static void _datetime_buf_cpy_p(char *dst, const char *src) { @@ -403,13 +391,3 @@ datetime_strftime_misc(const struct tm *tm, char **out, size_t *buf_sz, return _datetime_strftime(FORMATS_MISC, tm, out, buf_sz, buf, i); } - -double -datetime_diff_epoch(time_t t) -{ - time_t epoch; - - epoch = timegm(&DATETIME_EPOCH_); - - return difftime(t, epoch); -} diff --git a/src/datetime.h b/src/datetime.h index 9de8799..1094cf8 100644 --- a/src/datetime.h +++ b/src/datetime.h @@ -38,7 +38,4 @@ int datetime_strftime_misc(const struct tm *tm, char **out, size_t *out_sz, char **buf, size_t *i); -double -datetime_diff_epoch(time_t t); - #endif /* DATETIME_H_ */ -- cgit v0.9.1