diff options
author | B. Stack <bgstack15@gmail.com> | 2021-06-12 09:59:08 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2021-06-12 09:59:23 -0400 |
commit | fc71e66e5186fb75206290deca2b9a6cfbefa9ac (patch) | |
tree | b8076aea9d6e6408500ea8925ff233c2159a220b /zen | |
parent | Merge branch '11.10' into 'master' (diff) | |
download | FreeFileSync-fc71e66e5186fb75206290deca2b9a6cfbefa9ac.tar.gz FreeFileSync-fc71e66e5186fb75206290deca2b9a6cfbefa9ac.tar.bz2 FreeFileSync-fc71e66e5186fb75206290deca2b9a6cfbefa9ac.zip |
add upstream 11.11
Diffstat (limited to 'zen')
-rw-r--r-- | zen/file_access.cpp | 2 | ||||
-rw-r--r-- | zen/i18n.h | 2 | ||||
-rw-r--r-- | zen/legacy_compiler.h | 6 | ||||
-rw-r--r-- | zen/string_base.h | 4 | ||||
-rw-r--r-- | zen/string_tools.h | 3 | ||||
-rw-r--r-- | zen/time.h | 14 |
6 files changed, 19 insertions, 12 deletions
diff --git a/zen/file_access.cpp b/zen/file_access.cpp index fb770f19..db4f2505 100644 --- a/zen/file_access.cpp +++ b/zen/file_access.cpp @@ -668,7 +668,7 @@ FileCopyResult zen::copyNewFile(const Zstring& sourceFile, const Zstring& target /* we cannot set the target file times (::futimes) while the file descriptor is still open after a write operation: this triggers bugs on Samba shares where the modification time is set to current time instead. Linux: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=340236 - http://comments.gmane.org/gmane.linux.file-systems.cifs/2854 + http://comments.gmane.org/gmane.linux.file-systems.cifs/2854 macOS: https://freefilesync.org/forum/viewtopic.php?t=356 */ setWriteTimeNative(targetFile, sourceInfo.st_mtim, ProcSymlink::follow); //throw FileError } @@ -58,7 +58,7 @@ std::shared_ptr<const TranslationHandler> getTranslator(); namespace impl { //getTranslator() may be called even after static objects of this translation unit are destroyed! -inline constinit2 Global<const TranslationHandler> globalTranslationHandler; +inline constinit Global<const TranslationHandler> globalTranslationHandler; } inline diff --git a/zen/legacy_compiler.h b/zen/legacy_compiler.h index 66b750c9..50d340ca 100644 --- a/zen/legacy_compiler.h +++ b/zen/legacy_compiler.h @@ -24,15 +24,9 @@ namespace std { - - } //--------------------------------------------------------------------------------- -//constinit - #define constinit2 constinit //GCC, clang have it - - namespace zen { double fromChars(const char* first, const char* last); diff --git a/zen/string_base.h b/zen/string_base.h index f0899433..5c17fb47 100644 --- a/zen/string_base.h +++ b/zen/string_base.h @@ -10,7 +10,7 @@ #include <algorithm> #include <atomic> #include "string_tools.h" -#include "legacy_compiler.h" //constinit2 +#include "legacy_compiler.h" //constinit //Zbase - a policy based string class optimizing performance and flexibility @@ -209,7 +209,7 @@ private: static_assert(offsetof(GlobalEmptyString, nullTerm) - offsetof(GlobalEmptyString, descr) == sizeof(Descriptor), "no gap!"); static_assert(std::is_trivially_destructible_v<GlobalEmptyString>, "this memory needs to live forever"); - inline static constinit2 GlobalEmptyString globalEmptyString; //constinit: dodge static initialization order fiasco! + inline static constinit GlobalEmptyString globalEmptyString; //constinit: dodge static initialization order fiasco! }; diff --git a/zen/string_tools.h b/zen/string_tools.h index 8150df05..5f9273c9 100644 --- a/zen/string_tools.h +++ b/zen/string_tools.h @@ -568,9 +568,8 @@ template <class S, class T, class Num> inline S printNumber(const T& format, const Num& number) //format a single number using ::sprintf { #ifdef __cpp_lib_format -#error refactor +#error refactor? #endif - static_assert(std::is_same_v<GetCharTypeT<S>, GetCharTypeT<T>>); const int BUFFER_SIZE = 128; @@ -159,11 +159,23 @@ TimeComp getUtcTime2(time_t utc) { //1. convert: seconds since year 1: //... + //assert(time_t is signed) //TODO: what if < 0? long long remDays = utc / (24 * 3600); long long remSecs = utc % (24 * 3600); + //days per year + const int dpYearStd = 365; + const int dpYearLeap = dpYearStd + 1; + const int dp4Years = 3 * dpYearStd + dpYearLeap; + const int dp100YearsStd = 25 * dp4Years - 1; //no leap days for centuries... + const int dp100YearsExc = 25 * dp4Years; //...except if divisible by 400 + const int dp400Years = 3 * dp100YearsStd + dp100YearsExc; + + + + const int daysPer4Years = 4 * 365 /*usual days per year*/ + 1 /*including leap day*/; const int daysPerYear = 365; //non-leap const int daysPer100Years = 25 * daysPer4Years - 1; @@ -197,6 +209,8 @@ TimeComp getUtcTime2(time_t utc) + const char daysPerMonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + //first four years of century: |