Make wxDateTime invalid after Set((time_t)-1) call.
Closes #14776. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72750 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1781,9 +1781,16 @@ inline wxDateTime wxDateTime::Today()
|
|||||||
#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
|
#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
|
||||||
inline wxDateTime& wxDateTime::Set(time_t timet)
|
inline wxDateTime& wxDateTime::Set(time_t timet)
|
||||||
{
|
{
|
||||||
// assign first to avoid long multiplication overflow!
|
if ( timet == (time_t)-1 )
|
||||||
m_time = timet - WX_TIME_BASE_OFFSET ;
|
{
|
||||||
m_time *= TIME_T_FACTOR;
|
m_time = wxInvalidDateTime.m_time;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// assign first to avoid long multiplication overflow!
|
||||||
|
m_time = timet - WX_TIME_BASE_OFFSET;
|
||||||
|
m_time *= TIME_T_FACTOR;
|
||||||
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@@ -483,6 +483,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
Constructs the object from @a timet value holding the number of seconds
|
Constructs the object from @a timet value holding the number of seconds
|
||||||
since Jan 1, 1970.
|
since Jan 1, 1970.
|
||||||
|
|
||||||
|
If @a timet is invalid, i.e. @code (time_t)-1 @endcode, wxDateTime
|
||||||
|
becomes invalid too, i.e. its IsValid() will return @false.
|
||||||
*/
|
*/
|
||||||
wxDateTime& Set(time_t timet);
|
wxDateTime& Set(time_t timet);
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user