From 749a7f2f489c9c16f015d76275d989c2d141cdc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Tue, 28 Feb 2017 15:23:30 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@314 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- src/core/pitime.cpp | 21 +++++++++++++++++++-- src/core/pitime.h | 2 ++ 2 files changed, 21 insertions(+), 2 deletions(-) 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;