Запись времени UTC повторяется с 1:00 до 1:59 утра дважды, за 5 часов до начала летнего времени
UTC time record 5 hours before start of Spring Day Light Saving, displays 1:00 to 1:59 UTC time duration am twice. First, from 8:00 pm to 8:59 pm and then again from 9:00 pm to 9:59 pm. UTC time becomes normal 3:00 am again at local 10 pm time. when local time goes to 8:59 pm to 9:00 pm on 11 March '17, UTC time goes back from 1:59 am to 1:00 am and since then continue to record time upto 1:59 am. And when local time goes to 9:59 pm to 10:00 pm same day, UTC time records goes to 1:59 am to 3:00 am. It all happening before start of Day light saving (5 hours before in UTC-5 time zone). Summary: local time duration ----------------- UTC time duration (11th March '17) --------------------- (12th March '17) 8:00pm to 8:59 pm -------------- 1:00 am to 1:59 am 9:00pm to 9:59 pm -------------- 1:00 am to 1:59 am 10:00 pm onwards --------------- 3:00 am onwards
Что я уже пробовал:
double TimeCalculationClass :: GetUTCTime() { struct tm* starTime; struct tm stmTime; time_t localTimestamp = (long)m_dTime; double dTime; SYSTEMTIME sysTime, sysUTcST; FILETIME locFileTime, utcFileTime; dTime = m_dTime; /* Convert to a SYSTEMTIME */ sysTime.wSecond = (unsigned short)starTime->tm_sec; sysTime.wMinute = (unsigned short)starTime->tm_min; sysTime.wHour = (unsigned short)starTime->tm_hour; sysTime.wDay = (unsigned short)starTime->tm_mday; sysTime.wMonth = (unsigned short)(starTime->tm_mon + 1); sysTime.wYear = (unsigned short)(starTime->tm_year + 1900); sysTime.wMilliseconds = 0; /* convert to a local FileTime */ SystemTimeToFileTime(&sysTime, &locFileTime); /* convert local filetime to a file time based on the Coordinated Universal Time (UTC). */ LocalFileTimeToFileTime(&locFileTime, &utcFileTime); /* convert utc filetime to utc system time */ FileTimeToSystemTime(&utcFileTime, &sysUTcST); /* convert system time to struct tm */ stmTime.tm_sec = sysUTcST.wSecond; stmTime.tm_min = sysUTcST.wMinute; stmTime.tm_hour = sysUTcST.wHour; stmTime.tm_mday = sysUTcST.wDay; stmTime.tm_mon = sysUTcST.wMonth - 1; stmTime.tm_year = sysUTcST.wYear - 1900; stmTime.tm_wday = sysUTcST.wDayOfWeek; stmTime.tm_yday = 0; stmTime.tm_isdst = -1; dTime = (double)mktime(&stmTime); //if (stTime.wMilliseconds != 0) dTime = dTime + ((double)sysTime.wMilliseconds / 1000); return dTime; }