diff options
author | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:53:20 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:53:20 +0200 |
commit | 94db751716dd2851f99b5c4c2981da1d1f4780f8 (patch) | |
tree | e4ffc9f5ae2b2873f267a6e5d3d2092c8aad49a7 /zen/time.h | |
parent | 6.10 (diff) | |
download | FreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.tar.gz FreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.tar.bz2 FreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.zip |
6.11
Diffstat (limited to 'zen/time.h')
-rw-r--r-- | zen/time.h | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -49,8 +49,8 @@ const struct FormatIsoDateTimeTag {} FORMAT_ISO_DATE_TIME = {}; //%Y-%m-%d %H:%M //---------------------------------------------------------------------------------------------------------------------------------- -template <class String> -bool parseTime(const String& format, const String& str, TimeComp& comp); //similar to ::strptime(), return true on success +template <class String, class String2> +bool parseTime(const String& format, const String2& str, TimeComp& comp); //similar to ::strptime(), return true on success //---------------------------------------------------------------------------------------------------------------------------------- @@ -272,10 +272,11 @@ String formatTime(const String2& format, const TimeComp& comp) } -template <class String> -bool parseTime(const String& format, const String& str, TimeComp& comp) //return true on success +template <class String, class String2> +bool parseTime(const String& format, const String2& str, TimeComp& comp) //return true on success { typedef typename GetCharType<String>::Type CharType; + static_assert(IsSameType<CharType, typename GetCharType<String2>::Type>::value, ""); const CharType* iterFmt = strBegin(format); const CharType* const fmtLast = iterFmt + strLength(format); @@ -285,7 +286,7 @@ bool parseTime(const String& format, const String& str, TimeComp& comp) //return auto extractNumber = [&](int& result, size_t digitCount) -> bool { - if (strLast - iterStr < digitCount) + if (strLast - iterStr < makeSigned(digitCount)) return false; if (std::any_of(iterStr, iterStr + digitCount, [](CharType c) { return !isDigit(c); })) |