summaryrefslogtreecommitdiff
path: root/zen/time.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2015-10-02 14:53:20 +0200
committerDaniel Wilhelm <daniel@wili.li>2015-10-02 14:53:20 +0200
commit94db751716dd2851f99b5c4c2981da1d1f4780f8 (patch)
treee4ffc9f5ae2b2873f267a6e5d3d2092c8aad49a7 /zen/time.h
parent6.10 (diff)
downloadFreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.tar.gz
FreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.tar.bz2
FreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.zip
6.11
Diffstat (limited to 'zen/time.h')
-rw-r--r--zen/time.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/zen/time.h b/zen/time.h
index e94300a0..e53e4c6e 100644
--- a/zen/time.h
+++ b/zen/time.h
@@ -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); }))
bgstack15