scsh-users
[Top] [All Lists]

Re: time/date bugs in 0.5.0

To: scsh-news@martigny.ai.mit.edu
Subject: Re: time/date bugs in 0.5.0
From: Leif Nixon <nixon@softlab.se>
Date: 24 Apr 1997 22:34:26 +0200
Organization: Ericsson
Leif Nixon <nixon@softlab.se> writes:

> The reason I wind up in this cond branch is that I'm getting
> bogus results from time2date() in time1.c. Yes, it's another
> mktime() call that returns -1. To be precise, this one:
> 
>   #ifdef HAVE_GMTOFF      
>           *tz_secs = d.tm_gmtoff;
>   #else
>           { char **oldenv = environ;                    /* Set TZ to UTC     
> */
>             environ=utc_env;                            /* time temporarily. 
> */
>             tzset(); /* NetBSD, SunOS POSIX-noncompliance requires this. */
>             *tz_secs = mktime(&d) - t;
>             environ=oldenv;
>             }
>   #endif

If I patch this up to set the d.is_dst field to 0 and
to check for -1 return values from mktime(), the 'date'
function returns legal values. The values even denote the
correct time, but I still lose since it is only the first
call to 'date' that returns date values in the local time
zone:

  Scsh 0.5
  > (define d1 (date))
  > (define d2 (date))
  > (date:tz-name d1)
  "MET DST-2"
  > (date:tz-name d2)
  "UCT"
  > (time d1)
  861913321
  > (time d2)
  861913326
  > (date->string d1)
  "Thu Apr 24 22:22:01 1997"
  > (date->string d2)
  "Thu Apr 24 20:22:06 1997"
  > 


Leif Nixon                             SoftLab AB
-------------------------------------------------
E-mail: nixon@softlab.se   Phone: +46 13 23 57 61
-------------------------------------------------

<Prev in Thread] Current Thread [Next in Thread>