Re: Trying to use AUTHOR_DATE

From: Edgar Toernig <froese@gmx.de>
Date: 2005-04-30 20:40:48
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.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Sat Apr 30 20:41:31 2005

This archive was generated by hypermail 2.1.8 : 2005-04-30 20:41:32 EST