Rainmeter-0.14-src\Library\MeasureUptime.cpp Rainmeter-0.14-r2-src\Library\MeasureUptime.cpp
102/* 102/*
103** GetStringValue 103** GetStringValue
104** 104**
105** Returns the uptime as string. 105** Returns the uptime as string.
106** 106**
107*/  107*/ 
108const WCHAR* CMeasureUptime::GetStringValue(bool autoScale, double scale, int decimals, bool percentual) 108const WCHAR* CMeasureUptime::GetStringValue(bool autoScale, double scale, int decimals, bool percentual)
109{ 109{
110    static WCHAR buffer[MAX_LINE_LENGTH]; 110    static WCHAR buffer[MAX_LINE_LENGTH];
111  111 
112    size_t value = (size_t)m_Value; 112    size_t value = (size_t)m_Value;
113    size_t time[4]; 113    size_t time[4];
114  114 
115    time[0] = value % 60; 115    time[0] = value % 60;
116    time[1] = (value / 60) % 60; 116    time[1] = (value / 60) % 60;
117    time[2] = (value / (60 * 60)); 117    time[2] = (value / (60 * 60));
118    time[3] =  (value / (60 * 60 * 24)); 118    time[3] =  (value / (60 * 60 * 24));
119  119 
120    if (m_Format.find(L"%3") != std::wstring::npos)   120    if (m_Format.find(L"%4") != std::wstring::npos)  
121    { 121    {
122        time[2] %= 24; 122        time[2] %= 24;
123    } 123    }
124  124 
125    FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, m_Format.c_str(), 0, 0, buffer, MAX_LINE_LENGTH, (char**)time); 125    FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, m_Format.c_str(), 0, 0, buffer, MAX_LINE_LENGTH, (char**)time);
126  126 
127    return CheckSubstitute(buffer); 127    return CheckSubstitute(buffer);
128} 128}
129  129