This commit is contained in:
spx 2012-08-29 12:02:00 -07:00
parent de1cfb8504
commit c9bf2f131d

View File

@ -22,21 +22,14 @@
int GetYearDay(int year, int month, int day)
{
int yearDay = 0;
UINT dates[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
for (int i = 0; i < month - 1; ++i)
{
yearDay += dates[i];
}
static const int dates[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
int yearDay = dates[month - 1] + day;
if (month > 2 && ((((year % 4) == 0) && ((year % 100) != 0)) || (year % 400) == 0))
{
++yearDay;
}
yearDay += day;
return yearDay - 1;
}
@ -231,6 +224,8 @@ void CMeasureTime::ReadOptions(CConfigParser& parser, const WCHAR* section)
m_TimeStamp = parser.ReadFloat(section, L"TimeStamp", -1);
if (m_TimeStamp < 0.0)
{
const WCHAR* timezone = parser.ReadString(section, L"TimeZone", L"local").c_str();
if (_wcsicmp(L"local", timezone) == 0)
{
@ -273,6 +268,11 @@ void CMeasureTime::ReadOptions(CConfigParser& parser, const WCHAR* section)
m_DeltaTime.QuadPart = (LONGLONG)(zone * 3600) * 10000000;
}
}
}
else
{
m_DeltaTime.QuadPart = 0;
}
if (!m_Initialized)
{