aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorDaniel Neus <[email protected]>2017-03-21 22:10:23 +0100
committerDaniel Neus <[email protected]>2017-03-21 22:10:23 +0100
commit08a79d79f6df547346641b55b82426832c558cba (patch)
treec9549ea3040d2cd6d0daa7450b5c38d2d8fcedd3 /src/lib
parentf8a1e6b91908ee572f979a1de3b96b1f477ed128 (diff)
Fix #917: calendar_point::to_std_timepoint() does not support years after 2037
Only throw on systems where 32 bit std::time_t is used.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/utils/calendar.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/utils/calendar.cpp b/src/lib/utils/calendar.cpp
index 4f6c835d1..ddd424e0e 100644
--- a/src/lib/utils/calendar.cpp
+++ b/src/lib/utils/calendar.cpp
@@ -121,10 +121,11 @@ std::chrono::system_clock::time_point calendar_point::to_std_timepoint() const
// 32 bit time_t ends at January 19, 2038
// https://msdn.microsoft.com/en-us/library/2093ets1.aspx
- // For consistency reasons, throw after 2037 as long as
- // no other implementation is available.
- if (year > 2037)
+ // Throw after 2037 if 32 bit time_t is used
+ if (year > 2037 && sizeof(std::time_t) == 4)
+ {
throw Invalid_Argument("calendar_point::to_std_timepoint() does not support years after 2037.");
+ }
// std::tm: struct without any timezone information
std::tm tm;