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:
Vadim Zeitlin
2009-07-22 17:56:35 +00:00
parent eaed41872c
commit 57563c712b

View File

@@ -1722,7 +1722,9 @@ protected:
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 */