ref: 4087d6af9678b53fb2d3d2d5f5f6a6feff8e8a2b
parent: 8342f9a1e9bfc9f6db3253c5d633c2c77ffd6680
parent: b36d4fbf5ddc57fdcecffe441d1a10669816417b
author: Jeff Bezanson <[email protected]>
date: Wed Nov 16 06:31:16 EST 2016
Merge pull request #37 from dcurrie/issue-#34 Fix parsetime to initialize timezone, issue #34.
--- a/llt/timefuncs.c
+++ b/llt/timefuncs.c
@@ -82,7 +82,7 @@
{
time_t tme = (time_t)seconds;
-#ifdef LINUX
+#if defined(LINUX) || defined(MACOSX) || defined(OPENBSD) || defined(FREEBSD)
char *fmt = "%c"; /* needed to suppress GCC warning */
struct tm tm;
@@ -117,6 +117,8 @@
res = strptime(str, fmt, &tm);
if (res != NULL) {
+ tm.tm_isdst = -1; /* Not set by strptime(); tells mktime() to determine
+ whether daylight saving time is in effect */
t = mktime(&tm);
if (t == ((time_t)-1))
return -1;
--- a/tests/unittest.lsp
+++ b/tests/unittest.lsp
@@ -283,5 +283,9 @@
(assert (not (equal? (hash (iota 41))
(hash (iota 42)))))
+(if (top-level-bound? 'time.fromstring)
+ (assert (let ((ts (time.string (time.now))))
+ (eqv? ts (time.string (time.fromstring ts))))))
+
(princ "all tests pass\n")
#t