🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3792

Re: timezone macro for autoconf?

#3792
From: Russ Allbery
Date: Tue, 25 Apr 2000 00:00
40 lines
3039 bytes
In gnu.utils.help, Paul Eggert <eggert@twinsun.com> writes:

> 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.

Ah!  Thank you.  That makes sense.  I can see where that may well make a
difference.

> No standard time structure will do.  Neither struct tm nor struct
> timeval is guaranteed to contain a time zone.

True, but in checking into it, it turns out that INN very rarely actually
uses the timezone.  Getting that information in all of the places that INN
uses timestamps is therefore rather wasteful and pointless.

For a time that doesn't need an associated timezone, I think using time_t
or struct timeval is superior.  I'd really like to isolate the time zone
handling in INN to as few places as possible and just use UTC everywhere
else; I think it makes the code a lot easier to follow.

> 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).

Hm.  Except that I can't figure out how to get a struct timespec on
Solaris or older Linux without just converting a struct timeval, and
gettimeofday() is available nearly everywhere these days and returns a
struct timeval.  Right now, struct timeval looks like the de facto
standard regardless of what the de jure standard says.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>
Technical Details
Message-ID: <yl66t569md.fsf@windlord.stanford.edu>
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> <8e4lu9$fvu$1@ruby.twinsun.com>

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: Russ Allbery <rra@stanford.edu>
Subject: Re: timezone macro for autoconf?
Date: 2000/04/25
Message-ID: <yl66t569md.fsf@windlord.stanford.edu>
X-Deja-AN: 615682788
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> <8e4lu9$fvu$1@ruby.twinsun.com>
Content-Type: text/plain; charset=us-ascii
Organization: The Eyrie
Mime-Version: 1.0
User-Agent: Gnus/5.0802 (Gnus v5.8.2) XEmacs/21.1 (Biscayne)
Newsgroups: comp.unix.programmer,comp.os.linux.development.apps,gnu.utils.help