Ejemplo n.º 1
0
int CDateTimeSpan::GetSecondsTotal() const
{
    ULARGE_INTEGER time;
    ToULargeInt(time);

    return (int)(time.QuadPart/SECONDS_TO_FILETIME);
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
int CDateTimeSpan::GetHours() const
{
    ULARGE_INTEGER time;
    ToULargeInt(time);

    return (int)((time.QuadPart/SECONDS_TO_FILETIME)%SECONDS_PER_DAY)/SECONDS_PER_HOUR;
}
Ejemplo n.º 4
0
int CDateTimeSpan::GetDays() const
{
    ULARGE_INTEGER time;
    ToULargeInt(time);

    return (int)(time.QuadPart/SECONDS_TO_FILETIME)/SECONDS_PER_DAY;
}
Ejemplo n.º 5
0
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);
}
Ejemplo n.º 6
0
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);
}
Ejemplo n.º 7
0
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;
}
Ejemplo n.º 8
0
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;
}