R
Rajmohan
Hi All,
I need help with date and time conversions. gmtime() gives struct tm and
localtime() gives the same with local correction. Is there a GMT equivalen
of mktime() also? Here is my sample program.
***********************
time_t now, NOW;
struct tm *today;
time(&now);
printf ("now: %d\n", now);
today = localtime(&now);
NOW = mktime (today);
printf ("NOW: %d\n", NOW);
*************************
And the Output is:
now: 1058194848
NOW: 1058194848
Now if i use gmtime() instead of localtime(), the output is:
now: 1058194815
NOW: 1058175015
The time_t value is not the same. If i want to use gmtime(), then is there a
GMT equivalent api for mktime? Why is this disparity in values?
thanks in advance,
I need help with date and time conversions. gmtime() gives struct tm and
localtime() gives the same with local correction. Is there a GMT equivalen
of mktime() also? Here is my sample program.
***********************
time_t now, NOW;
struct tm *today;
time(&now);
printf ("now: %d\n", now);
today = localtime(&now);
NOW = mktime (today);
printf ("NOW: %d\n", NOW);
*************************
And the Output is:
now: 1058194848
NOW: 1058194848
Now if i use gmtime() instead of localtime(), the output is:
now: 1058194815
NOW: 1058175015
The time_t value is not the same. If i want to use gmtime(), then is there a
GMT equivalent api for mktime? Why is this disparity in values?
thanks in advance,