X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c20d5805aa9e99fb5b7094add9cd9229de8894e5..4e2a3778386d60356dab319afa2d3f987f86d6b2:/src/common/datetime.cpp diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index c2d360ccc0..f6ad3f6259 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -93,7 +93,7 @@ const long wxDateTime::TIME_T_FACTOR = 1000l; template<> void wxStringReadValue(const wxString &s , wxDateTime &data ) { - data.ParseFormat(s,"%Y-%m-%d %H:%M:%S"); + data.ParseFormat(s,"%Y-%m-%d %H:%M:%S", NULL); } template<> void wxStringWriteValue(wxString &s , const wxDateTime &data ) @@ -376,11 +376,13 @@ wxDateTime::Country wxDateTime::ms_country = wxDateTime::Country_Unknown; // debugger helper: shows what the date really is #ifdef __WXDEBUG__ -extern const wxChar *wxDumpDate(const wxDateTime* dt) +extern const char *wxDumpDate(const wxDateTime* dt) { - static wxChar buf[128]; + static char buf[128]; - wxStrcpy(buf, dt->Format(_T("%Y-%m-%d (%a) %H:%M:%S"))); + wxString fmt(dt->Format("%Y-%m-%d (%a) %H:%M:%S")); + wxStrncpy(buf, fmt + " (" + dt->GetValue().ToString() + " ticks)", + WXSIZEOF(buf)); return buf; } @@ -2845,8 +2847,9 @@ wxDateTime::ParseRfc822Date(const wxString& date, wxString::const_iterator *end) min = (wxDateTime_t)(min + *p++ - _T('0')); wxDateTime_t sec = 0; - if ( *p++ == _T(':') ) + if ( *p == _T(':') ) { + p++; if ( !wxIsdigit(*p) ) { return NULL; @@ -4588,4 +4591,30 @@ WXDLLIMPEXP_BASE void wxPrevWDay(wxDateTime::WeekDay& wd) : (wxDateTime::WeekDay)(wd - 1); } +#ifdef __WXMSW__ + +wxDateTime& wxDateTime::SetFromMSWSysTime(const SYSTEMTIME& st) +{ + return Set(st.wDay, + wx_static_cast(wxDateTime::Month, wxDateTime::Jan + st.wMonth - 1), + st.wYear, + 0, 0, 0); +} + +void wxDateTime::GetAsMSWSysTime(SYSTEMTIME* st) const +{ + const wxDateTime::Tm tm(GetTm()); + + st->wYear = (WXWORD)tm.year; + st->wMonth = (WXWORD)(tm.mon - wxDateTime::Jan + 1); + st->wDay = tm.mday; + + st->wDayOfWeek = + st->wHour = + st->wMinute = + st->wSecond = + st->wMilliseconds = 0; +} +#endif // __WXMSW__ + #endif // wxUSE_DATETIME