How to convert "struct tm" to the time in seconds

04/07/2009 - 22:17 von Juergen Beisert | Report spam
Hi,

does anybody know how to convert a time given in UTC in a "struct tm" into
the regular system time in seconds (also UTC)?

My problem is, my timezone is CET/CEST and "struct tm" is handled as a wall
clock (AFAIK). So, mktime() will convert the time with regard to my
timezone.
Is there a way to disable this (nice) feature? Or do I have to convert it by
myself to do a conversion UTC to UTC without timezone consideration?

Thanks in advance for some hints.
jbe
 

Lesen sie die antworten

#1 Alexander Bartolich
04/07/2009 - 23:15 | Warnen spam
Juergen Beisert schrieb:
Hi,

does anybody know how to convert a time given in UTC in a "struct tm" into
the regular system time in seconds (also UTC)?



man timegm
# For a portable version of timegm(), set the TZ environment variable
# to UTC, call mktime(3) and restore the value of TZ.

seq 100 | sed 's/.*/Romani Ite Domum./'

Ähnliche fragen