Subject: RE: time functions questions
To: 'Johan Danielsson' <joda@pdc.kth.se>
From: Scott Burns <Scott.Burns@Netcontech.Com>
List: tech-userlevel
Date: 11/22/2000 22:14:40
Thanks for the info.

I would have thought that if I produce a struct tm using the gmtime() function,
and use strftime() to produce a string representation of that struct, then the
%Z format would be based on the struct tm I am using. It seems odd that
one of the identifiers references the system timezone, but the others refer
to the time fields in the struct, for the time period of which the struct tm
was built for. Does this not seem counter intuitive ?

The man page description does not really describe the item is the system
time, and not the time zone of the tm structure.

"%Z    is replaced by the time zone name"

Scott..

-----Original Message-----
From:	Johan Danielsson [SMTP:joda@pdc.kth.se]
Sent:	Thursday, November 02, 2000 12:00 PM
To:	Scott.Burns@netcontech.com
Cc:	tech-userlevel@netbsd.org
Subject:	Re: time functions questions

Scott Burns <Scott.Burns@Netcontech.Com> writes:

> Is the a correct usage of mktime() is my one question (ie shoving in
> a localtime composed tm struct, and then reapplying gmtime() to it ?

Yes. I would probably set tm_isdst to -1 to be on the safe side.

> Why does the timezone print as EST on printf() number 2 and 4 ?
> Should a call to gmtime() not force the timezone to GMT ?

Because it outputs your machine zone name. It *maybe* should use
tm_zone if non-null, but it might not always be correct. And you can't
(for your own programs) assume that there's a tm_zone field in struct
tm.

/Johan