diff --git a/src/core/pitime.cpp b/src/core/pitime.cpp index fd0173b9..b40d5dde 100755 --- a/src/core/pitime.cpp +++ b/src/core/pitime.cpp @@ -310,6 +310,17 @@ PIString PIDateTime::toString(const PIString & format) const { #ifdef WINDOWS +PIDateTime::PIDateTime(SYSTEMTIME t) { + year = t.wYear; + month = t.wMonth; + day = t.wDay; + hours = t.wHour; + minutes = t.wMinute; + seconds = t.wSecond; + milliseconds = t.wMilliseconds; +} + + PIDateTime::PIDateTime(FILETIME t) { FILETIME lt; SYSTEMTIME st; @@ -325,8 +336,7 @@ PIDateTime::PIDateTime(FILETIME t) { } -FILETIME PIDateTime::toFILETIME() const { - FILETIME lt, ret; +SYSTEMTIME PIDateTime::toSYSTEMTIME() const { SYSTEMTIME st; st.wYear = year; st.wMonth = month; @@ -335,6 +345,13 @@ FILETIME PIDateTime::toFILETIME() const { st.wMinute = minutes; st.wSecond = seconds; st.wMilliseconds = milliseconds; + return st; +} + + +FILETIME PIDateTime::toFILETIME() const { + FILETIME lt, ret; + SYSTEMTIME st = toSYSTEMTIME(); SystemTimeToFileTime(&st, <); LocalFileTimeToFileTime(<, &ret); return ret; diff --git a/src/core/pitime.h b/src/core/pitime.h index 8176227b..95a8449b 100755 --- a/src/core/pitime.h +++ b/src/core/pitime.h @@ -228,7 +228,9 @@ struct PIP_EXPORT PIDateTime { PIDateTime(const PIDate & date) {year = date.year; month = date.month; day = date.day; hours = minutes = seconds = milliseconds = 0;} PIDateTime(const PIDate & date, const PITime & time) {year = date.year; month = date.month; day = date.day; hours = time.hours; minutes = time.minutes; seconds = time.seconds; milliseconds = time.milliseconds;} #ifdef WINDOWS + PIDateTime(SYSTEMTIME t); PIDateTime(FILETIME t); + SYSTEMTIME toSYSTEMTIME() const; FILETIME toFILETIME() const; #endif int year;