int GetTimeOffset(void) { struct tm *cur_time; time_t yesterday_time; if (!time_offset_set) { if (ParseTOT() != 0) { printf ("No local time in the TOT table. Please use the -t option.\n"); //:return -1; } } /* Get day of the week of yesterday (provider local time) */ // yesterday_time = UTC2ProviderLocalTime (time(NULL) - 86400); yesterday_time = UTC2LocalTime (time(NULL) - 86400); cur_time = gmtime(&yesterday_time); yesterday = cur_time->tm_wday; /* Get epoch of yesterday 00:00 (provider local time) */ cur_time->tm_hour = 0; cur_time->tm_min = 0; cur_time->tm_sec = 0; cur_time->tm_isdst = -1; // yesterday_epoch = UTC2ProviderLocalTime(mktime (cur_time)); yesterday_epoch = UTC2LocalTime(mktime (cur_time)); return 0; }
dword DST_FindNextTransition(void) { TRACEENTER(); dword DSTStartUTC, DSTEndUTC; dword ret; if(DSTRule == DSTR_Undefined) DST_GetDefaultDSTRule(); ret = 0; switch(DSTRule) { case DSTR_Undefined: case DSTR_Firmware: { break; } case DSTR_Europe: { DST_GetTransitions_Europe(&DSTStartUTC, &DSTEndUTC, 0); ret = (DSTStartUTC < DSTEndUTC) ? DSTStartUTC : DSTEndUTC; ret = UTC2LocalTime(ret, NULL); break; } case DSTR_Manual: { DST_GetTransitions_Manual(&DSTStartUTC, &DSTEndUTC); ret = (DSTStartUTC < DSTEndUTC) ? DSTStartUTC : DSTEndUTC; ret = UTC2LocalTime(ret, NULL); break; } } TRACEEXIT(); return ret; }