From: Edgar Toernig Date: Sat, 30 Apr 2005 10:40:48 GMT Subject: Re: Trying to use AUTHOR_DATE Message-ID: <20050430124048.79119cac.froese@gmx.de> In-Reply-To: <1114848175.24014.35.camel@localhost.localdomain> David Woodhouse wrote: > > Eww. The time functions we have to play with _really_ suck, don't they? > How about this... > > + then += tm.tm_gmtoff; tm_gmtoff is not available everywhere - POSIX doesn't even mention it (BSD?). 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: void make_datestamp(char *buf) { time_t now; struct tm *tm; int tz; time(&now); tm = localtime(&now); /* get timezone and tm_isdst */ tz = -timezone / 60; if (tm->tm_isdst > 0) tz += 60; sprintf(buf, "%lu %+05d", now, tz/60*100+tz%60); } That *should* work on any POSIX system but who knows ... Ciao, ET.