localtime(), ctime() and timezones

Moderator, John Quarterman std-unix at ut-sally.UUCP
Sat Mar 8 02:30:16 AEST 1986


Date: 6 Mar 86 23:09:30 EST (Thu)
From: floyd!opus!ka at SEISMO.CSS.GOV (Kenneth Almquist)
Organization: Bell Labs, Holmdel, NJ

I basicly agree with Robert Elz.  A few comments:

1)  I suggest adding an entry for the timezone name to the tm
structure.  Something like

	char tm_zone[6];

I expect that time zone names will not exceed 5 characters, although
the size of this array need not be specified in the standard.  I don't
suggest making tm_zone a character pointer because if that were done
any implementation would be complicated by the need to ensure that
tm_zone was still valid after settz was called with a different time
zone.

2)  The routine name is gmtime, not gmttime.

3)  Removing the explicit mention of a time zone directory from the
standard means that there is no longer a way to find the offset of time
zone that a time zone name represents.  How about providing a routine
to do this:

	long tzoffset(tzname)  char *tzname;

which takes a time zone name and returns the offset of that time zone
in seconds with respect to GMT?
				Kenneth Almquist
				ihnp4!houxm!hropus!ka	(official name)
				ihnp4!opus!ka		(shorter path)

Volume-Number: Volume 5, Number 67



More information about the Mod.std.unix mailing list