~ chicken-core (chicken-5) 1f54db006a918ffd4d06917595b9bc4a4b17a680


commit 1f54db006a918ffd4d06917595b9bc4a4b17a680
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Mon Jul 26 10:26:53 2010 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Mon Jul 26 10:26:53 2010 +0200

    timezone fixes (thanks to zbigniew)

diff --git a/posixunix.scm b/posixunix.scm
index c90481a3..e17f6b3e 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -355,7 +355,7 @@ static time_t C_timegm(struct tm *t)
     (ptm)->tm_isdst = (C_block_item((v), 8) != C_SCHEME_FALSE))
 
 #define cpy_tmvec_to_tmstc9(ptm, v) \
-    (((struct tm *)ptm)->tm_gmtoff = C_unfix(C_block_item((v), 9)))
+    (((struct tm *)ptm)->tm_gmtoff = -C_unfix(C_block_item((v), 9)))
 
 #define cpy_tmstc08_to_tmvec(v, ptm) \
     (C_set_block_item((v), 0, C_fix(((struct tm *)ptm)->tm_sec)), \
@@ -369,7 +369,7 @@ static time_t C_timegm(struct tm *t)
     C_set_block_item((v), 8, ((ptm)->tm_isdst ? C_SCHEME_TRUE : C_SCHEME_FALSE)))
 
 #define cpy_tmstc9_to_tmvec(v, ptm) \
-    (C_set_block_item((v), 9, C_fix((ptm)->tm_gmtoff)))
+    (C_set_block_item((v), 9, C_fix(-(ptm)->tm_gmtoff)))
 
 #define C_tm_set_08(v)  cpy_tmvec_to_tmstc08( &C_tm, (v) )
 #define C_tm_set_9(v)   cpy_tmvec_to_tmstc9( &C_tm, (v) )
diff --git a/runtime.c b/runtime.c
index c60190f7..a2f6dbe5 100644
--- a/runtime.c
+++ b/runtime.c
@@ -7775,13 +7775,13 @@ void C_ccall C_decode_seconds(C_word c, C_word closure, C_word k, C_word secs, C
 		  C_fix(tmt->tm_mday), C_fix(tmt->tm_mon), C_fix(tmt->tm_year),
 		  C_fix(tmt->tm_wday), C_fix(tmt->tm_yday),
 		  tmt->tm_isdst > 0 ? C_SCHEME_TRUE : C_SCHEME_FALSE,
-#ifdef C_MACOSX
+#ifdef C_GNU_ENV
                   /* negative for west of UTC, but we want positive */
 		  C_fix(-tmt->tm_gmtoff)
 #elif defined(__CYGWIN__) || defined(__MINGW32__) || defined(_WIN32) || defined(__WINNT__)
-                  C_fix(_timezone)
+                  C_fix(mode == C_SCHEME_FALSE ? _timezone : 0) /* does not account for DST */
 #else
-                  C_fix(timezone)
+                  C_fix(mode == C_SCHEME_FALSE ? timezone : 0)  /* does not account for DST */
 #endif
 		  );
   C_kontinue(k, info);
Trap