Article View: comp.unix.programmer
Article #3787Re: timezone macro for autoconf?
From: Dan Kegel
Date: Sun, 23 Apr 2000 00:00
Date: Sun, 23 Apr 2000 00:00
21 lines
2013 bytes
2013 bytes
Dan Kegel wrote: > Russ Allbery wrote: > > >>> Does anyone have a good autoconf macro for figuring out > > >>> how to get at the timezone offset (the extern int) portably? > > >> No, but I need to write one for INN as well. > > > The most portable way to get the time zone offset is to invoke localtime > > > and gmtime on the same time_t value, and then compute the offset > > > yourself from the two broken-down times. This works on any system that > > > conforms to either K&R C or to Standard C (either 1989 or 1999). > > Right. This is what INN currently falls back to if struct tm doesn't have > > the tm_gmtoff member. Hey! BSD has this neat timegm() function which is the inverse of gmtime(). glibc has it too, though it's undocumented. Wish I'd noticed that sooner. And why the heck isn't that in the Single Unix Spec (SUS)? It sure would be handy. - Dan -- Entia non sunt multiplicanda praeter necessitatem.
Technical Details
Message-ID:
<3903EA8C.733A052A@alumni.caltech.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<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>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109f73,8ce1c34c9f5a1eaa X-Google-Attributes: gid109f73,public X-Google-Thread: 10c696,8ce1c34c9f5a1eaa X-Google-Attributes: gid10c696,public X-Google-Thread: fc89c,8ce1c34c9f5a1eaa X-Google-Attributes: gidfc89c,public From: Dan Kegel <dank@alumni.caltech.edu> Subject: Re: timezone macro for autoconf? Date: 2000/04/23 Message-ID: <3903EA8C.733A052A@alumni.caltech.edu> X-Deja-AN: 614883345 Content-Transfer-Encoding: 7bit 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> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@swbell.net X-Trace: news.swbell.net 956557841 63.201.176.178 (Mon, 24 Apr 2000 01:30:41 CDT) Organization: SBC Internet Services MIME-Version: 1.0 NNTP-Posting-Date: Mon, 24 Apr 2000 01:30:41 CDT Newsgroups: comp.unix.programmer,comp.os.linux.development.apps,gnu.utils.help