tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Arrigo Triulzi <arrigo () albourne ! com>
To: tru64-unix-managers
Subject: BUG: 4.0F/4.0G Libc tzset(3)
Date: Tue, 27 Mar 2001 15:00:52 +0000	[thread overview]
Message-ID: <98570527412995.tru64-unix-managers.marc@archive.invalid> (raw)

Dear all,

there appears to be a bug in the libc definition of tzset(), both
under 4.0F (PK#2 + NHDv3) and 4.0G (PK#2).

According to the documentation for tzset(3) [man 3 tzset]:
``
  The external variable timezone is set to the difference, in seconds,
  between Coordinated Universal Time (UTC) and local standard time.  For
  example:
                                TZ    timezone
                                EST   5*60*60
                                GMT   0*60*60
                                JST   -9*60*60
                                MET   -1*60*60
                                MST   7*60*60
                                PST   8*60*60
''

This does not appear to be the case:

/* tzset-test.c */
#include <stdio.h>
#include <time.h>
#include <stdlib.h>

main()
{
    char *timezone="TZ=GMT0";

    putenv(timezone);
    tzset();
    printf("daylight=%d\ntimezone=%ld\ntzname[0]=%s\ntzname[1]=%s\n",
           daylight, timezone,
           (tzname[0] ? tzname[0] : "NULL"),
           (tzname[1] ? tzname[0] : "NULL"));
    exit(0);
}

terracotta:/tmp$ ./tzset-test 
daylight=0
timezone=5368709312
tzname[0]=GMT
tzname[1]=GMT

The timezone value should be 0 according to the man page.  The
remaining values are correct.  Linux appears to have the same problem.

umbra:/tmp$ ./tzset-test 
daylight=0
timezone=134514176
tzname[0]=GMT
tzname[1]=GMT

Does this mean that the timezone variable should not be trusted?

Best Regards,

Arrigo Triulzi

-- 
Arrigo Triulzi <arrigo@albourne.com>
Albourne Partners Ltd. - London, UK

                 reply	other threads:[~2001-03-27 15:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox