chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] utc-time->seconds and local-time->seconds rationale?


From: John Cowan
Subject: Re: [Chicken-users] utc-time->seconds and local-time->seconds rationale?
Date: Wed, 7 May 2014 10:46:37 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

Peter Bex scripsit:

> In my opinion, large parts of the POSIX unit should die.  They're broken,
> at the wrong level of abstraction and just generally unschemely.  The
> reason these time things are breaking is because the libc time access
> is so varying across operating systems.

In this case, it's a plain implementation failure:  the simulation for
tm_gmtoff on non-GNU/BSD systems is broken.  Here's a patch:

--- runtime.c.orig      2014-05-07 10:19:44.108430900 -0400
+++ runtime.c   2014-05-07 10:21:11.024402300 -0400
@@ -8180,9 +8180,9 @@
                   /* 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(mode == C_SCHEME_FALSE ? _timezone : 0) /* does not 
account for DST */
+                  C_fix(mode == C_SCHEME_FALSE ? _timezone - _daylight * 3600 
: 0)
 #else
-                  C_fix(mode == C_SCHEME_FALSE ? timezone : 0)  /* does not 
account for DST */
+                  C_fix(mode == C_SCHEME_FALSE ? timezone - daylight * 3600 : 
0)
 #endif
                  );
   C_kontinue(k, info);


I don't know why whoever wrote this simply added a comment saying DST
was not taken into account instead of taking it into account.  Actually,
avoiding tm_gmtoff altogether would be more portable.

-- 
John Cowan          http://www.ccil.org/~cowan        address@hidden
But that, he realized, was a foolish thought; as no one knew better than
he that the Wall had no other side.
        --Arthur C. Clarke, "The Wall of Darkness"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]