- time_t t = time(0); // get unix time. sec.
-
- struct tm* data;
- data = localtime(&t); // save time as structure.
- retv_if(!data, FALSE);
- data->tm_isdst = 0; // summer time, not applied.
- time_t a = mktime(data);
-
- data = gmtime(&a);
- data->tm_isdst = 0; // summer time, not applied.
- time_t b = mktime(data);
-
- int gmtoffset_hour = (a-b)/3600; // result : hour.
- int gmtoffset_min = ((a-b)%3600)/60; // result : min.
- if(gmtoffset_min != 0)
- gmtoffset_min = 30;
-
- snprintf(szTimezone, GMT_BUF_SIZE, "%+d:%u", gmtoffset_hour, gmtoffset_min);
-
- SETTING_TRACE("szTimezone is of a valid format: GMT: %s", szTimezone);