[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How do I parse an UTC date?



> > How do I convert a struct tm to a time_t? There's mktime(3), but it only
> > deals with local times. I would need the inverse function of gmtime(3).
> There are at least 2 choices.
> 1) Set TZ=UTC and use mktime.
> 2) Write a special routine "mkgmtime".
>
> The first is easy to do but may have some side effects.  You have to
> put the real value of TZ back.  I am not sure if you would have to
> call tzset yourself or not.
>
> The second is not too hard and I have some code if you want.  It works
> but I haven't looked at it lately.

Ugh.. . this is a huge hole in the libc! I'm now copying the getdate.y from
CVS, and trying to use that.

Thanks!




Reply to: