diff options
Diffstat (limited to 'zen/time.h')
-rw-r--r-- | zen/time.h | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -154,8 +154,8 @@ struct GetFormat<FormatIsoDateTimeTag> //%Y-%m-%d %H:%M:%S - e.g. 2001-08-23 14: //strftime() craziness on invalid input: -// VS 2010: CRASH unless "_invalid_parameter_handler" is set: http://msdn.microsoft.com/en-us/library/ksazx244.aspx -// GCC: returns 0, apparently no crash. Still, considering some clib maintainer's comments, we should expect the worst! +// VS 2010: CRASH unless "_invalid_parameter_handler" is set: http://msdn.microsoft.com/en-us/library/ksazx244.aspx +// GCC: returns 0, apparently no crash. Still, considering some clib maintainer's comments, we should expect the worst! inline size_t strftimeWrap_impl(char* buffer, size_t bufferSize, const char* format, const struct std::tm* timeptr) { @@ -173,12 +173,12 @@ size_t strftimeWrap_impl(wchar_t* buffer, size_t bufferSize, const wchar_t* form inline bool isValid(const struct std::tm& t) { - -> not enough! MSCRT has different limits than the C standard which even seem to change with different versions: - _VALIDATE_RETURN((( timeptr->tm_sec >=0 ) && ( timeptr->tm_sec <= 59 ) ), EINVAL, FALSE) - _VALIDATE_RETURN(( timeptr->tm_year >= -1900 ) && ( timeptr->tm_year <= 8099 ), EINVAL, FALSE) - -> also std::mktime does *not* help here at all! + -> not enough! MSCRT has different limits than the C standard which even seem to change with different versions: + _VALIDATE_RETURN((( timeptr->tm_sec >=0 ) && ( timeptr->tm_sec <= 59 ) ), EINVAL, FALSE) + _VALIDATE_RETURN(( timeptr->tm_year >= -1900 ) && ( timeptr->tm_year <= 8099 ), EINVAL, FALSE) + -> also std::mktime does *not* help here at all! - auto inRange = [](int value, int minVal, int maxVal) { return minVal <= value && value <= maxVal; }; + auto inRange = [](int value, int minVal, int maxVal) { return minVal <= value && value <= maxVal; }; //http://www.cplusplus.com/reference/clibrary/ctime/tm/ return inRange(t.tm_sec , 0, 61) && |