diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:15:39 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:15:39 +0200 |
commit | d2854834e18443876c8f75e0a7f3b88d1d549fc4 (patch) | |
tree | e967b628081e50abc7c34cd264e6586271c7e728 /wx+/format_unit.cpp | |
parent | 4.1 (diff) | |
download | FreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.tar.gz FreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.tar.bz2 FreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.zip |
4.2
Diffstat (limited to 'wx+/format_unit.cpp')
-rw-r--r-- | wx+/format_unit.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/wx+/format_unit.cpp b/wx+/format_unit.cpp index 771778aa..994a2b29 100644 --- a/wx+/format_unit.cpp +++ b/wx+/format_unit.cpp @@ -7,6 +7,7 @@ #include "format_unit.h" #include <zen/basic_math.h> #include <zen/i18n.h> +#include <zen/time.h> #include <cwchar> //swprintf #include <ctime> #include <cstdio> @@ -211,22 +212,17 @@ std::wstring zen::utcToLocalTimeString(Int64 utcTime) return _("Error"); } - struct tm loc = {}; - loc.tm_year = systemTimeLocal.wYear - 1900; - loc.tm_mon = systemTimeLocal.wMonth - 1; - loc.tm_mday = systemTimeLocal.wDay; - loc.tm_hour = systemTimeLocal.wHour; - loc.tm_min = systemTimeLocal.wMinute; - loc.tm_sec = systemTimeLocal.wSecond; - const struct tm* timePtr = &loc; + zen::TimeComp loc; + loc.year = systemTimeLocal.wYear; + loc.month = systemTimeLocal.wMonth; + loc.day = systemTimeLocal.wDay; + loc.hour = systemTimeLocal.wHour; + loc.minute = systemTimeLocal.wMinute; + loc.second = systemTimeLocal.wSecond; #elif defined FFS_LINUX - const time_t fileTime = to<time_t>(utcTime); - const struct tm* timePtr = ::localtime(&fileTime); //convert to local time + zen::TimeComp loc = zen::localTime(to<time_t>(utcTime)); #endif - wchar_t buffer[1000]; - size_t charsWritten = std::wcsftime(buffer, 1000, L"%x %X", timePtr); - - return std::wstring(buffer, charsWritten); + return formatTime<std::wstring>(L"%x %X", loc); } |