int CDateTimeSpan::GetSecondsTotal() const { ULARGE_INTEGER time; ToULargeInt(time); return (int)(time.QuadPart/SECONDS_TO_FILETIME); }
int CDateTimeSpan::GetSeconds() const { ULARGE_INTEGER time; ToULargeInt(time); return (int)(((time.QuadPart/SECONDS_TO_FILETIME%SECONDS_PER_DAY)%SECONDS_PER_HOUR)%SECONDS_PER_MINUTE)%SECONDS_PER_MINUTE; }
int CDateTimeSpan::GetHours() const { ULARGE_INTEGER time; ToULargeInt(time); return (int)((time.QuadPart/SECONDS_TO_FILETIME)%SECONDS_PER_DAY)/SECONDS_PER_HOUR; }
int CDateTimeSpan::GetDays() const { ULARGE_INTEGER time; ToULargeInt(time); return (int)(time.QuadPart/SECONDS_TO_FILETIME)/SECONDS_PER_DAY; }
void CDateTimeSpan::SetDateTimeSpan(int day, int hour, int minute, int second) { ULARGE_INTEGER time; ToULargeInt(time); time.QuadPart=(uint64_t)day*SECONDS_PER_DAY*SECONDS_TO_FILETIME; time.QuadPart+=(uint64_t)hour*SECONDS_PER_HOUR*SECONDS_TO_FILETIME; time.QuadPart+=(uint64_t)minute*SECONDS_PER_MINUTE*SECONDS_TO_FILETIME; time.QuadPart+=(uint64_t)second*SECONDS_TO_FILETIME; FromULargeInt(time); }
void CDateTimeSpan::SetDateTimeSpan(int day, int hour, int minute, int second) { ULARGE_INTEGER time; ToULargeInt(time); time.QuadPart= static_cast<long long>(day) *SECONDS_PER_DAY*SECONDS_TO_FILETIME; time.QuadPart+= static_cast<long long>(hour) *SECONDS_PER_HOUR*SECONDS_TO_FILETIME; time.QuadPart+= static_cast<long long>(minute) *SECONDS_PER_MINUTE*SECONDS_TO_FILETIME; time.QuadPart+= static_cast<long long>(second) *SECONDS_TO_FILETIME; FromULargeInt(time); }
const CDateTime& CDateTime::operator -=(const CDateTimeSpan& right) { ULARGE_INTEGER timeThis; ToULargeInt(timeThis); ULARGE_INTEGER timeRight; right.ToULargeInt(timeRight); timeThis.QuadPart-=timeRight.QuadPart; FromULargeInt(timeThis); return *this; }
CDateTimeSpan CDateTime::operator -(const CDateTime& right) const { CDateTimeSpan left; ULARGE_INTEGER timeLeft; left.ToULargeInt(timeLeft); ULARGE_INTEGER timeThis; ToULargeInt(timeThis); ULARGE_INTEGER timeRight; right.ToULargeInt(timeRight); timeLeft.QuadPart=timeThis.QuadPart-timeRight.QuadPart; left.FromULargeInt(timeLeft); return left; }