Use wxINT32_MAX instead of LONG_MAX as the upper bound in wxDateTime::IsInStdRange().
Under Debian Linux 64 bit time_t is 64 bit long but libc doesn't seem to handle values beyond 2^32 correctly, e.g. wrong results are returned from localtime() for them. And it would seem that platforms where sizeof(long) > sizeof(time_t) might exist too so it seems safer to only work with 32 bit time_t values until we can reliably detect platforms which support 64 bit ones. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61497 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1722,7 +1722,9 @@ protected:
|
|||||||
|
|
||||||
inline bool wxDateTime::IsInStdRange() const
|
inline bool wxDateTime::IsInStdRange() const
|
||||||
{
|
{
|
||||||
return m_time >= 0l && (m_time / TIME_T_FACTOR) < LONG_MAX;
|
// currently we don't know what is the real type of time_t so prefer to err
|
||||||
|
// on the safe side and limit it to 32 bit values which is safe everywhere
|
||||||
|
return m_time >= 0l && (m_time / TIME_T_FACTOR) < wxINT32_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
Reference in New Issue
Block a user