c - mktime() giving different results for same input in different timezone -
here piece of code converting fri jan 1 00:00:00 ist 1970
epoch
memset(&date_st,0,sizeof(struct tm)); date_st.tm_year = 70; date_st.tm_mon = 0; date_st.tm_mday = 1; date_st.tm_hour = 24; date_st.tm_min = 0; date_st.tm_sec = 0; date_st.tm_isdst = 0 ; date_in_seconds = mktime( &date_st );
the code running on 2 servers having different time zones
server_1!:user_1> tue aug 25 11:03:51 idt 2015
server_2!:user_2> tue aug 25 05:05:03 clt 2015
now code gives different output on different servers same input fri jan 1 00:00:00 ist 1970
server_1 -> 79200 server_2 -> 100800
can suggest why output different? , how can make same {i want same} ?
that's timezones about, local time different.
you might want try gmtime
function instead, if want common reference time.
Comments
Post a Comment