Re: Trying to use AUTHOR_DATE
- From
- Russ Allbery <rra@stanford.edu>
- Date
- Apr 30, 2005, 18:10 UTC
- Message-ID
- <87r7gs87a9.fsf@windlord.stanford.edu>
- In-Reply-To
- <20050430124048.79119cac.froese@gmx.de>
Edgar Toernig <froese@gmx.de> writes:
> Oh btw, when we are about sucking time functions: the %s and %z > strftime- sequences used further down are also non-standard (POSIX has > no %s, old libc has neither %s nor %z).
> A possible workaround:
[...]
> tm = localtime(&now); /* get timezone and tm_isdst */ > tz = -timezone / 60; > if (tm->tm_isdst > 0) > tz += 60;
The global timezone variable isn't available on all systems. :)
You really cannot get portable behavior in this area without something akin to Autoconf probes, unfortunately. Oh, and you can't assume daylight savings time is an hour; it is sometimes two hours. You have to instead use the altzone variable to get the offset when you're in daylight savings time, but this again isn't available on all systems.
I posted a pointer to the INN source a while back; I'm really not sure that anything less is sufficient to get full portability, although I certainly trust Paul Eggart's implementation.
BTW, the yacc-based thing is exactly what I wrote the INN code to get rid of, since I didn't want a yacc dependency.
-- Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>