Wrap text
|
|
189,191c189,193
< time_t rawtime;
< struct tm * timeinfo;
<
---
> long gmtoffset;
>
> time_t t1, t2;
> struct tm tm;
>
201,203c203,207
< // Get localtime
< time(&rawtime);
< timeinfo = localtime(&rawtime);
---
> // begin ANSI GMT offset calculation
> t1 = time(0);
> tm = *gmtime(&t1);
> t2 = mktime(&tm);
> gmtoffset = (long) difftime(t1,t2);
207,208c211,212
< int hour_offset = abs(timeinfo->tm_gmtoff) / 3600;
< int minute_offset = abs(timeinfo->tm_gmtoff) % 3600 / 60;
---
> int hour_offset = abs(gmtoffset) / 3600;
> int minute_offset = abs(gmtoffset) % 3600 / 60;
211c215
< if (timeinfo->tm_gmtoff < 0) {
---
> if (gmtoffset < 0) {
235c239
< offset = seconds_to_offset(timeinfo->tm_gmtoff);
---
> offset = seconds_to_offset(gmtoffset);
|