I want to construct a struct tm
with Australia/Sydney
timezone, so I first use:
setenv("TZ","Australia/Sydney",1);
tzset()
then I set the struct tm
as:
struct tm _tm;
_tm.tm_sec = 0;
_tm.tm_min = 45;
_tm.tm_hour = 7;
_tm.tm_mday = 18;
_tm.tm_mon = 8;
_tm.tm_year = 114;
This should set to Australia time 2014/09/18 7:45:00 then I call:
time_t other_tm = mktime(&_tm);
After this call both other_tm
and _tm
pointed to 6:45am of Australia time! The reason is other_tm has value 1410986700 which you can verify from Epoc converter it indeeds pointed to 6:45am, anybody has an idea why?