// ------------------------------------------------------------------------
// default ctor does not initialize the object, use Set()!
- wxDateTime() { }
+ wxDateTime() { m_time = wxLongLong((long)ULONG_MAX, ULONG_MAX); }
// from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970)
#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
// result of timezone shift)
// ------------------------------------------------------------------------
- // is the date valid? Note that this will return TRUE for non
- // initialized objects but FALSE if *this == wxInvalidDateTime
+ // is the date valid?
inline bool IsValid() const { return m_time != wxInvalidDateTime.m_time; }
// get the broken down date/time representation in the given timezone
// in the fine tradition of ANSI C we use our equivalent of (time_t)-1 to
// indicate an invalid wxDateTime object
-#ifdef __WIN16__
+
static const wxDateTime gs_dtDefault;
-#else
-static const wxDateTime gs_dtDefault = wxLongLong((long)ULONG_MAX, ULONG_MAX);
-#endif
const wxDateTime& wxDefaultDateTime = gs_dtDefault;
// the values in the tm structure contain the local time
wxDateTime& wxDateTime::Set(const struct tm& tm)
{
- wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") );
-
struct tm tm2(tm);
time_t timet = mktime(&tm2);
wxDateTime_t second,
wxDateTime_t millisec)
{
- wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") );
-
// we allow seconds to be 61 to account for the leap seconds, even if we
// don't use them really
wxDATETIME_CHECK( hour < 24 &&
wxDateTime_t second,
wxDateTime_t millisec)
{
- wxASSERT_MSG( IsValid(), _T("invalid wxDateTime") );
-
wxDATETIME_CHECK( hour < 24 &&
second < 62 &&
minute < 60 &&
// take this date as default
tmDef = dateDef.GetTm();
}
-#ifdef __WIN16__
- else if ( m_time != 0 )
-#else
- else if ( m_time != wxLongLong(0) )
-#endif
+ else if ( IsValid() )
{
// if this date is valid, don't change it
tmDef = GetTm();