Peter N Lewis peter at stairways.com.au
Tue Mar 18 04:14:24 CET 2003

>  > Can GPC not sometimes have 16 bit Integer?  Because if so, that field
>>  would be too small.
>No, `Integer' is at least 32 bits.

Ok, fair enough.

>  > Hmm, the TimeZone on my system comes back as:
>>  TimeZone (in seconds): -1878692308
>Just to be sure, a test program like this does so?
>program Foo;
>   t: TimeStamp;
>   GetTimeStamp (t);
>   WriteLn (t.TimeValid, ' ', t.TimeZone)

True -1878692308

>What does the following C program give?
>#include <stdio.h>
>#include <sys/time.h>
>#if 0  /* Set if variable not defined */
>extern long int timezone;
>int main ()
>   time_t s = (time_t) time (0);
>   localtime (&s);
>   printf ("%li\n", (long int) timezone);
>   return 0;

It returns the same number.

>Do you find any mentioning of `timezone' in the system headers?

man timezone gives:

TIMEZONE(3)             System Library Functions Manual            TIMEZONE(3)

      timezone - return the timezone abbreviation

      Standard C Library (libc, -lc)

      char *
      timezone(int zone, int dst);

      This interface is for compatibility only; it is impossible to reliably
      map timezone's arguments to a time zone abbreviation.  See ctime(3).

      The timezone() function returns a pointer to a time zone abbreviation for
      the specified zone and dst values.  Zone is the number of minutes west of
      GMT and dst is non-zero if daylight savings time is in effect.


      A timezone() function appeared in Version 7 AT&T UNIX.

BSD                             April 19, 1994                             BSD

Seems like you need to call localtime and use the tm_gmtoff field.

I imagine this would be the same as under FreeBSD as Mac OS X's unix 
is based on FreeBSD.


<http://www.interarchy.com/>  <http://download.interarchy.com/>

More information about the Gpc mailing list