mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fixed that Time measure logs invalid format error due to uninitialized m_Time.
http://rainmeter.net/forum/viewtopic.php?f=14&t=13124
This commit is contained in:
parent
956465b96c
commit
7e627cf5f3
@ -87,11 +87,7 @@ void CMeasureTime::TimeToString(WCHAR* buf, size_t bufLen, const WCHAR* format,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
void CMeasureTime::FillCurrentTime()
|
||||||
** Updates the current time
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
void CMeasureTime::UpdateValue()
|
|
||||||
{
|
{
|
||||||
FILETIME ftUTCTime;
|
FILETIME ftUTCTime;
|
||||||
GetSystemTimeAsFileTime(&ftUTCTime);
|
GetSystemTimeAsFileTime(&ftUTCTime);
|
||||||
@ -102,6 +98,15 @@ void CMeasureTime::UpdateValue()
|
|||||||
m_Time.LowPart = ftUTCTime.dwLowDateTime;
|
m_Time.LowPart = ftUTCTime.dwLowDateTime;
|
||||||
|
|
||||||
m_Time.QuadPart += m_DeltaTime.QuadPart;
|
m_Time.QuadPart += m_DeltaTime.QuadPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Updates the current time
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
void CMeasureTime::UpdateValue()
|
||||||
|
{
|
||||||
|
FillCurrentTime();
|
||||||
|
|
||||||
if (!m_Format.empty())
|
if (!m_Format.empty())
|
||||||
{
|
{
|
||||||
@ -258,4 +263,10 @@ void CMeasureTime::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
m_DeltaTime.QuadPart = (LONGLONG)(zone * 3600) * 10000000;
|
m_DeltaTime.QuadPart = (LONGLONG)(zone * 3600) * 10000000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_Initialized)
|
||||||
|
{
|
||||||
|
// Initialize m_Time to avoid causing EINVAL in TimeToString() until calling UpdateValue()
|
||||||
|
FillCurrentTime();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void TimeToString(WCHAR* buf, size_t bufLen, const WCHAR* format, const tm* time);
|
void TimeToString(WCHAR* buf, size_t bufLen, const WCHAR* format, const tm* time);
|
||||||
|
void FillCurrentTime();
|
||||||
|
|
||||||
std::wstring m_Format;
|
std::wstring m_Format;
|
||||||
LARGE_INTEGER m_DeltaTime;
|
LARGE_INTEGER m_DeltaTime;
|
||||||
|
Loading…
Reference in New Issue
Block a user