git-svn-id: svn://db.shs.com.ru/pip@400 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2017-04-18 20:49:45 +00:00
parent b1b23bf89c
commit 95c1f34b45
192 changed files with 291 additions and 187 deletions

View File

@@ -0,0 +1,69 @@
#ifndef PITIME_WIN_H
#define PITIME_WIN_H
#include "pibase.h"
#ifdef WINDOWS
#include "pitime.h"
#include <windows.h>
//inline PISystemTime SYSTEMTIME2PISystemTime(SYSTEMTIME &t) {
// PISystemTime st;
//}
inline PISystemTime FILETIME2PISystemTime(const FILETIME &t) {
PISystemTime st;
ullong lt = ullong(t.dwHighDateTime) * 0x100000000U + ullong(t.dwLowDateTime);
st.seconds = lt / 10000000U;
st.nanoseconds = (lt % 10000000U) * 100U;
return st;
}
inline PIDateTime SYSTEMTIME2PIDateTime(const SYSTEMTIME &t) {
PIDateTime dt;
dt.year = t.wYear;
dt.month = t.wMonth;
dt.day = t.wDay;
dt.hours = t.wHour;
dt.minutes = t.wMinute;
dt.seconds = t.wSecond;
dt.milliseconds = t.wMilliseconds;
return dt;
}
inline PIDateTime FILETIME2PIDateTime(const FILETIME &t) {
FILETIME lt;
SYSTEMTIME st;
FileTimeToLocalFileTime(&t, &lt);
FileTimeToSystemTime(&lt, &st);
return SYSTEMTIME2PIDateTime(st);
}
inline SYSTEMTIME PIDateTime2SYSTEMTIME(const PIDateTime &dt) {
SYSTEMTIME st;
st.wYear = dt.year;
st.wMonth = dt.month;
st.wDay = dt.day;
st.wHour = dt.hours;
st.wMinute = dt.minutes;
st.wSecond = dt.seconds;
st.wMilliseconds = dt.milliseconds;
return st;
}
inline FILETIME PIDateTime2FILETIME(const PIDateTime &dt) {
FILETIME lt, ret;
SYSTEMTIME st = PIDateTime2SYSTEMTIME(dt);
SystemTimeToFileTime(&st, &lt);
LocalFileTimeToFileTime(&lt, &ret);
return ret;
}
#endif // WINDOWS
#endif // PITIME_WIN_H