Hey all,
I have a program that gets the current time by using CTime tmDTG = CTime::GetCurrentTime(); And it worked fine until daylight savings came around now the current time is one hour off. I have tried getting the time by using time.h functions (i.e. using:
time_t tTempTime;
time (&tTempTime);
struct tm * sT;
sT = localtime(&tTempTime);
CTime tmDTG(sT->tm_year + 1900, sT->tm_mon + 1, sT->tm_mday, sT->tm_hour, sT->tm_min, sT->tm_sec, 0);
I have tried using _putenv("TZ=GMT" and have even tried setting each environmental variable (i.e. _timezone, _tzname[0], _tzname[1] and _daylight)
All have returned the time off by 1 hour. There must be a way to get the correct time without resorting to manually adding an hour.
Any help is appreciated,
JC
I have a program that gets the current time by using CTime tmDTG = CTime::GetCurrentTime(); And it worked fine until daylight savings came around now the current time is one hour off. I have tried getting the time by using time.h functions (i.e. using:
time_t tTempTime;
time (&tTempTime);
struct tm * sT;
sT = localtime(&tTempTime);
CTime tmDTG(sT->tm_year + 1900, sT->tm_mon + 1, sT->tm_mday, sT->tm_hour, sT->tm_min, sT->tm_sec, 0);
I have tried using _putenv("TZ=GMT" and have even tried setting each environmental variable (i.e. _timezone, _tzname[0], _tzname[1] and _daylight)
All have returned the time off by 1 hour. There must be a way to get the correct time without resorting to manually adding an hour.
Any help is appreciated,
JC