[misc.misc] timezones query

wdr@cstowe.csoft.co.nz (Bill) (02/04/88)

Hello Fellow Readers out there in NetLand.

  I have been having fun with timezones recently and need to get a
definitive answer on what my timezone offset should read on my mail
headers. Unfortunately I do not have a copy of RFC822 which
apparently tells you what it should be.

  The reason for me posting this query is I have noticed various
machines use a different sign for the offset even if they are in the
same time zone.

eg.
    mxvax.cwi.nl (They are in the Netherlands) use +0100 (MET)
but dutrun       (who are also in the Netherlands) use -0100 (MET)

Hmmmm.

What I want to know is - is the offset added to GMT time to get local
time, or is the offset added to local time to get GMT time?

   I would be inclined to have our offset as +1300 as we are ahead of
GMT time, but our installation script says a negative offset indicates
we are east of Greenwich (which we are) which would make it -1300.
Also the program below only gets the answers right if the offset is
negative.

Note the instance of USA chauvinism, they are positive and we (ie New
Zealand, Aus, those East of London etc) are negative, phooey :->.  In
fact I get the feeling that because the U.K. got to have Greenwich
they decided to keep the USA happy by making them positive :-).


    
----- Don't Bother Cutting, it don't do much --------

#include <stdio.h>
#include <time.h>

main()
{
        long now;
        struct tm localTime,gmtTime;

        now = time();

        localTime = *localtime(&now);
        spludgeTm("LocalTime",localTime);

        gmtTime = *gmtime(&now);
        spludgeTm("GmtTime",gmtTime);

        tzset(); /* Have to do this to set timezone, which is external,
                                                   below */
        fprintf(stderr,"Time Zone Offset is %ld\n",timezone);/* This be -ve */
        exit(0);

}

spludgeTm(what,timeIs)
char *what;
struct tm timeIs;
{
        fprintf(stderr,"%s is = %d:%d:%d  %d/%d/%d\n",what,
                        timeIs.tm_hour,timeIs.tm_min,timeIs.tm_sec,
                        timeIs.tm_mday,timeIs.tm_mon,timeIs.tm_year);
}

----------------------------------------------------------------

    BTW we are using a Tower 32/600 running NCR release 1.03.01
which is (as far as I can tell) System V.2.

Mail me or post to usenet, whatever works for you.


DISCLAIMER - what they don't know can't hurt them.


-- 
Bill D. Ryder                        ...!uunet!vuwcomp!dsiramd!pnamd!cstowe!wdr
Phone 063-65955 (IDD 64)         or  wdr@csoft.co.nz
Commercial Software N.Z. Ltd., PO Box 4030                                     
Palmerston North,  Aotearoa (New Zealand if want to use snail mail)

wales@CS.UCLA.EDU (02/09/88)

Regarding the sign of time zones in Europe:

In the "Date:" line of an RFC822-format message, Central European Time
(1 hour east of GMT) is represented as "+0100".  That is, "east" is
"positive", and "west" is "negative".

A site in The Netherlands which is using "-0100" as the time zone offset
in its outgoing mail is in error.  (Unless they mean to imply that The
Netherlands have moved to a new location west of Ireland. :-})

As various other people have recently pointed out, RFC822 contains an
error in that the signs of the single-letter time zone designators (page
26) were inadvertently reversed.  Thus, 12 noon (Central European Time)
may be written as "12:00 A" (*NOT* "12:00 N").  This error has caused
endless confusion, sad to say.

When installing most (all?) UNIX systems, on the other hand, the time
zone offset in the kernel configuration file is of the opposite sign
(i.e., "east" is "negative", and "west" is "positive").  The reason for
this is historical and USA-chauvinistic:  UNIX was developed in the USA
by programmers who undoubtedly never dreamed at the time that it would
become the international sensation it is now.

-- Rich Wales // UCLA Computer Science Department // +1 (213) 825-5683
	3531 Boelter Hall // Los Angeles, California 90024-1596 // USA
	wales@CS.UCLA.EDU           ...!(ucbvax,rutgers)!ucla-cs!wales
"Sir, there is a multilegged creature crawling on your shoulder."