[PATCH 2/2 v2] compat/timegm: new compat function for systems lacking timegm()
Jason A. Donenfeld
Jason at zx2c4.com
Thu Apr 4 16:59:50 CEST 2013
On Thu, Apr 4, 2013 at 4:46 PM, John Keeping <john at keeping.me.uk> wrote:
> I decided not to do that based on this message:
> but of course it doesn't provide any actual reason for why that version
> doesn't work.
Aye yie yie. Time handling functions are a mess. I just went looking at how
glibc  and uclibc  actually go about doing things, and it's a real
mess in there. Looks like the replacement function in the patch might not
be completely correct.
(uclibc gets bonus points for using cgit)
> We only use timegm in week calculations, where we do:
> time_t t = timegm(tm);
> t = <new value>;
> gmtime_r(&t, tm);
> so I wonder whether it would be equivalent to use mktime/localtime_r
> instead of timegm/gmtime_r.
gmtime(timegm(tm)) == tm
localtime(mktime(tm)) == tm
So I can't imagine there'd be a problem with just replacing those functions.
More information about the CGit