2010-01-09 145 views

回答

1

這是做到這一點的一種方法。

`

long int SBias, SSeconds, LSeconds; 

SYSTEMTIME STIME,LTIME; SystemTimeToTzSpecificLocalTime(& TZ,& STime,& LTime);

SSeconds = 3600L * STime.wHour + 60L * STime.wMinute + STime.wSecond; 
LSeconds = 3600L * LTime.wHour + 60L * LTime.wMinute + LTime.wSecond; 

SBias = 60L * (TZ.Bias + TZ.StandardBias); 

SSeconds -= SBias; 
if (SSeconds < 0) SSeconds += 24L * 3600L; 

if (SSeconds == LSeconds) 
{ 
    tmX.tm_isdst = 0; 
    StdTime  = true; 
} 
else 
{ 
    tmX.tm_isdst = 1; 
    StdTime  = false; 
} 

`