diff options
author | B. Stack <bgstack15@gmail.com> | 2022-10-11 15:17:59 +0000 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-10-11 15:17:59 +0000 |
commit | 38c826621a39831d1bdc78aa9e45cc592db3e77f (patch) | |
tree | a49cfd729d9793681a57fa6f7409b0f0848e9ede /zen/time.h | |
parent | Merge branch 'b11.25' into 'master' (diff) | |
parent | add upstream 11.26 (diff) | |
download | FreeFileSync-38c826621a39831d1bdc78aa9e45cc592db3e77f.tar.gz FreeFileSync-38c826621a39831d1bdc78aa9e45cc592db3e77f.tar.bz2 FreeFileSync-38c826621a39831d1bdc78aa9e45cc592db3e77f.zip |
Merge branch 'b11.26' into 'master'11.26
add upstream 11.26
See merge request opensource-tracking/FreeFileSync!49
Diffstat (limited to 'zen/time.h')
-rw-r--r-- | zen/time.h | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -272,14 +272,14 @@ Zstring formatTime(const Zchar* format, const TimeComp& tc) std::mktime(&ctc); //unfortunately std::strftime() needs all elements of "struct tm" filled, e.g. tm_wday, tm_yday //note: although std::mktime() explicitly expects "local time", calculating weekday and day of year *should* be time-zone and DST independent - Zstring buffer(256, Zstr('\0')); + Zstring buf(256, Zstr('\0')); //strftime() craziness on invalid input: // VS 2010: CRASH unless "_invalid_parameter_handler" is set: https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation // GCC: returns 0, apparently no crash. Still, considering some clib maintainer's comments, we should expect the worst! // Windows: avoid char-based strftime() which uses ANSI encoding! (e.g. Greek letters for AM/PM) - const size_t charsWritten = std::strftime(&buffer[0], buffer.size(), format, &ctc); - buffer.resize(charsWritten); - return buffer; + const size_t charsWritten = std::strftime(buf.data(), buf.size(), format, &ctc); + buf.resize(charsWritten); + return buf; } |