[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).
> 
> Any help will be appreciated.
> 
> Thanks!
> 
> (please CC me the replies)
> 
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.

jim
> -- 
> To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact
> listmaster@lists.debian.org
> 



Reply to: