🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3791

Re: timezone macro for autoconf?

#3791
From: Paul Eggert
Date: Tue, 25 Apr 2000 00:00
37 lines
2899 bytes
Russ Allbery <rra@stanford.edu> writes:

>So what you're saying is that code based
>on timezone will fail if the definition (in terms of UTC offset) of the
>local timezone has changed since the point at which the daemon was
>started?

No, that's another bug entirely (one that few daemons have fixed).

I was referring to the problem that different time stamps correspond to
different UTC offsets.  E.g. the value for 'timezone' for Portugal
today is 0, since Portugal's standard time is now the same as
Greenwich.  But from 1992 to 1996 Portugal had a standard time one hour
ahead of Greenwich.  So if 'timezone' contains the value zero (which is
correct for Portuguese time stamps today), time_t values between 1992
and 1996 won't be handled correctly in a Portuguese locale.

This problem doesn't occur when comparing the outputs of localtime and
gmtime, since their outputs can (and, in good implementations, do)
use standard-time UTC offsets that depend on the time stamp in question.

>I'm rather unsatisfied with how time is currently handled in INN primarily
>because INN uses its own weird time structure internally rather than
>either just time_t or a struct timeval.

No standard time structure will do.  Neither struct tm nor struct
timeval is guaranteed to contain a time zone.  And when the code was
written, struct timeval wasn't standardized (and it's still absent from
some hosts); time_t plus some other stuff was the only portable way to go.

These days the most "standard" way to write it would be to use struct
timespec, as it's standardized by POSIX.1 (struct timeval is not).
However, the standards are still mutating in this area -- the next C
standard after C99 might well have a new time type -- so personally I'd
just leave INN alone for now.

Your other points are well taken.
Technical Details
Message-ID: <8e4lu9$fvu$1@ruby.twinsun.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <38FBB4DB.DE12E1C4@alumni.caltech.edu> <ylog78chos.fsf@windlord.stanford.edu> <8di5uf$8p0$1@ruby.twinsun.com> <ylaeiryr7f.fsf@windlord.stanford.edu> <3903E142.FBD4E5E8@alumni.caltech.edu> <ylitx8qbiy.fsf@windlord.stanford.edu> <8e2dtj$ff6$1@ruby.twinsun.com> <ylsnwbj6jb.fsf@windlord.stanford.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10c696,8ce1c34c9f5a1eaa
X-Google-Attributes: gid10c696,public
X-Google-Thread: 109f73,8ce1c34c9f5a1eaa
X-Google-Attributes: gid109f73,public
X-Google-Thread: fc89c,8ce1c34c9f5a1eaa
X-Google-Attributes: gidfc89c,public
From: eggert@twinsun.com (Paul Eggert)
Subject: Re: timezone macro for autoconf?
Date: 2000/04/25
Message-ID: <8e4lu9$fvu$1@ruby.twinsun.com>
X-Deja-AN: 615560832
References: <38FBB4DB.DE12E1C4@alumni.caltech.edu> <ylog78chos.fsf@windlord.stanford.edu> <8di5uf$8p0$1@ruby.twinsun.com> <ylaeiryr7f.fsf@windlord.stanford.edu> <3903E142.FBD4E5E8@alumni.caltech.edu> <ylitx8qbiy.fsf@windlord.stanford.edu> <8e2dtj$ff6$1@ruby.twinsun.com> <ylsnwbj6jb.fsf@windlord.stanford.edu>
X-Complaints-To: news@twinsun.com
X-Trace: tattoo.twinsun.com 956685064 16929 192.54.239.31 (25 Apr 2000 17:51:04 GMT)
Organization: Twin Sun Inc, El Segundo, CA, USA
NNTP-Posting-Date: 25 Apr 2000 17:51:04 GMT
Newsgroups: comp.unix.programmer,comp.os.linux.development.apps,gnu.utils.help