summaryrefslogtreecommitdiff
path: root/zen/format_unit.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <shieldwed@outlook.com>2017-01-08 18:21:23 +0100
committerDaniel Wilhelm <shieldwed@outlook.com>2017-01-08 18:21:23 +0100
commitfe660cdff59aa3a939479ed60172e5c0803552b2 (patch)
tree045cf295b79de10f75ed6362c5836db25c9fc63a /zen/format_unit.cpp
parent8.6 (diff)
downloadFreeFileSync-fe660cdff59aa3a939479ed60172e5c0803552b2.tar.gz
FreeFileSync-fe660cdff59aa3a939479ed60172e5c0803552b2.tar.bz2
FreeFileSync-fe660cdff59aa3a939479ed60172e5c0803552b2.zip
8.7
Diffstat (limited to 'zen/format_unit.cpp')
-rw-r--r--zen/format_unit.cpp55
1 files changed, 29 insertions, 26 deletions
diff --git a/zen/format_unit.cpp b/zen/format_unit.cpp
index d87a1643..08463778 100644
--- a/zen/format_unit.cpp
+++ b/zen/format_unit.cpp
@@ -16,7 +16,7 @@
#ifdef ZEN_WIN
#include "int64.h"
#include "win.h" //includes "windows.h"
- #include "win_ver.h"
+ // #include "win_ver.h"
#elif defined ZEN_LINUX || defined ZEN_MAC
#include <clocale> //thousands separator
@@ -155,6 +155,12 @@ std::wstring zen::remainingTimeToString(double timeInSec)
}
+//std::wstring zen::fractionToString1Dec(double fraction)
+//{
+// return printNumber<std::wstring>(L"%.1f", fraction * 100.0) + L'%'; //no need to internationalize fraction!?
+//}
+
+
std::wstring zen::fractionToString(double fraction)
{
return printNumber<std::wstring>(L"%.2f", fraction * 100.0) + L'%'; //no need to internationalize fraction!?
@@ -299,32 +305,29 @@ std::wstring zen::utcToLocalTimeString(std::int64_t utcTime)
SYSTEMTIME systemTimeLocal = {};
- static const bool useNewLocalTimeCalculation = zen::vistaOrLater();
-
//https://msdn.microsoft.com/en-us/library/ms724277
- if (useNewLocalTimeCalculation) //DST conversion like in Windows 7: NTFS stays fixed, but FAT jumps by one hour
- {
- SYSTEMTIME systemTimeUtc = {};
- if (!::FileTimeToSystemTime(&lastWriteTimeUtc, //__in const FILETIME *lpFileTime,
- &systemTimeUtc)) //__out LPSYSTEMTIME lpSystemTime
- return errorMsg();
-
- if (!::SystemTimeToTzSpecificLocalTime(nullptr, //__in_opt LPTIME_ZONE_INFORMATION lpTimeZone,
- &systemTimeUtc, //__in LPSYSTEMTIME lpUniversalTime,
- &systemTimeLocal)) //__out LPSYSTEMTIME lpLocalTime
- return errorMsg();
- }
- else //DST conversion like in Windows 2000 and XP: FAT times stay fixed, while NTFS jumps
- {
- FILETIME fileTimeLocal = {};
- if (!::FileTimeToLocalFileTime(&lastWriteTimeUtc, //_In_ const FILETIME *lpFileTime,
- &fileTimeLocal)) //_Out_ LPFILETIME lpLocalFileTime
- return errorMsg();
-
- if (!::FileTimeToSystemTime(&fileTimeLocal, //__in const FILETIME *lpFileTime,
- &systemTimeLocal)) //__out LPSYSTEMTIME lpSystemTime
- return errorMsg();
- }
+#ifdef ZEN_WIN_VISTA_AND_LATER
+ //DST conversion like in Vista and later: NTFS stays fixed, but FAT jumps by one hour
+ SYSTEMTIME systemTimeUtc = {};
+ if (!::FileTimeToSystemTime(&lastWriteTimeUtc, //__in const FILETIME *lpFileTime,
+ &systemTimeUtc)) //__out LPSYSTEMTIME lpSystemTime
+ return errorMsg();
+
+ if (!::SystemTimeToTzSpecificLocalTime(nullptr, //__in_opt LPTIME_ZONE_INFORMATION lpTimeZone,
+ &systemTimeUtc, //__in LPSYSTEMTIME lpUniversalTime,
+ &systemTimeLocal)) //__out LPSYSTEMTIME lpLocalTime
+ return errorMsg();
+#else
+ //DST conversion like in Windows 2000 and XP: FAT times stay fixed, while NTFS jumps
+ FILETIME fileTimeLocal = {};
+ if (!::FileTimeToLocalFileTime(&lastWriteTimeUtc, //_In_ const FILETIME *lpFileTime,
+ &fileTimeLocal)) //_Out_ LPFILETIME lpLocalFileTime
+ return errorMsg();
+
+ if (!::FileTimeToSystemTime(&fileTimeLocal, //__in const FILETIME *lpFileTime,
+ &systemTimeLocal)) //__out LPSYSTEMTIME lpSystemTime
+ return errorMsg();
+#endif
zen::TimeComp loc;
loc.year = systemTimeLocal.wYear;
bgstack15