Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
5.3 KiB

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1995 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. // Inlines for AFX.H
  11. #ifdef _AFX_INLINE
  12. // CTime and CTimeSpan
  13. _AFX_INLINE CTimeSpan::CTimeSpan()
  14. { }
  15. _AFX_INLINE CTimeSpan::CTimeSpan(time_t time)
  16. { m_timeSpan = time; }
  17. _AFX_INLINE CTimeSpan::CTimeSpan(LONG lDays, int nHours, int nMins, int nSecs)
  18. { m_timeSpan = nSecs + 60* (nMins + 60* (nHours + 24* lDays)); }
  19. _AFX_INLINE CTimeSpan::CTimeSpan(const CTimeSpan& timeSpanSrc)
  20. { m_timeSpan = timeSpanSrc.m_timeSpan; }
  21. _AFX_INLINE const CTimeSpan& CTimeSpan::operator=(const CTimeSpan& timeSpanSrc)
  22. { m_timeSpan = timeSpanSrc.m_timeSpan; return *this; }
  23. _AFX_INLINE LONG CTimeSpan::GetDays() const
  24. { return (LONG)(m_timeSpan / (24*3600L)); }
  25. _AFX_INLINE LONG CTimeSpan::GetTotalHours() const
  26. { return (LONG)(m_timeSpan/3600); }
  27. _AFX_INLINE int CTimeSpan::GetHours() const
  28. { return (int)(GetTotalHours() - GetDays()*24); }
  29. _AFX_INLINE LONG CTimeSpan::GetTotalMinutes() const
  30. { return (LONG)(m_timeSpan/60); }
  31. _AFX_INLINE int CTimeSpan::GetMinutes() const
  32. { return (int)(GetTotalMinutes() - GetTotalHours()*60); }
  33. _AFX_INLINE LONG_PTR CTimeSpan::GetTotalSeconds() const
  34. { return m_timeSpan; }
  35. _AFX_INLINE int CTimeSpan::GetSeconds() const
  36. { return (int)(GetTotalSeconds() - GetTotalMinutes()*60); }
  37. _AFX_INLINE CTimeSpan CTimeSpan::operator-(CTimeSpan timeSpan) const
  38. { return CTimeSpan(m_timeSpan - timeSpan.m_timeSpan); }
  39. _AFX_INLINE CTimeSpan CTimeSpan::operator+(CTimeSpan timeSpan) const
  40. { return CTimeSpan(m_timeSpan + timeSpan.m_timeSpan); }
  41. _AFX_INLINE const CTimeSpan& CTimeSpan::operator+=(CTimeSpan timeSpan)
  42. { m_timeSpan += timeSpan.m_timeSpan; return *this; }
  43. _AFX_INLINE const CTimeSpan& CTimeSpan::operator-=(CTimeSpan timeSpan)
  44. { m_timeSpan -= timeSpan.m_timeSpan; return *this; }
  45. _AFX_INLINE BOOL CTimeSpan::operator==(CTimeSpan timeSpan) const
  46. { return m_timeSpan == timeSpan.m_timeSpan; }
  47. _AFX_INLINE BOOL CTimeSpan::operator!=(CTimeSpan timeSpan) const
  48. { return m_timeSpan != timeSpan.m_timeSpan; }
  49. _AFX_INLINE BOOL CTimeSpan::operator<(CTimeSpan timeSpan) const
  50. { return m_timeSpan < timeSpan.m_timeSpan; }
  51. _AFX_INLINE BOOL CTimeSpan::operator>(CTimeSpan timeSpan) const
  52. { return m_timeSpan > timeSpan.m_timeSpan; }
  53. _AFX_INLINE BOOL CTimeSpan::operator<=(CTimeSpan timeSpan) const
  54. { return m_timeSpan <= timeSpan.m_timeSpan; }
  55. _AFX_INLINE BOOL CTimeSpan::operator>=(CTimeSpan timeSpan) const
  56. { return m_timeSpan >= timeSpan.m_timeSpan; }
  57. _AFX_INLINE CTime::CTime()
  58. { }
  59. _AFX_INLINE CTime::CTime(time_t time)
  60. { m_time = time; }
  61. _AFX_INLINE CTime::CTime(const CTime& timeSrc)
  62. { m_time = timeSrc.m_time; }
  63. _AFX_INLINE const CTime& CTime::operator=(const CTime& timeSrc)
  64. { m_time = timeSrc.m_time; return *this; }
  65. _AFX_INLINE const CTime& CTime::operator=(time_t t)
  66. { m_time = t; return *this; }
  67. _AFX_INLINE time_t CTime::GetTime() const
  68. { return m_time; }
  69. _AFX_INLINE int CTime::GetYear() const
  70. { return (GetLocalTm(NULL)->tm_year) + 1900; }
  71. _AFX_INLINE int CTime::GetMonth() const
  72. { return GetLocalTm(NULL)->tm_mon + 1; }
  73. _AFX_INLINE int CTime::GetDay() const
  74. { return GetLocalTm(NULL)->tm_mday; }
  75. _AFX_INLINE int CTime::GetHour() const
  76. { return GetLocalTm(NULL)->tm_hour; }
  77. _AFX_INLINE int CTime::GetMinute() const
  78. { return GetLocalTm(NULL)->tm_min; }
  79. _AFX_INLINE int CTime::GetSecond() const
  80. { return GetLocalTm(NULL)->tm_sec; }
  81. _AFX_INLINE int CTime::GetDayOfWeek() const
  82. { return GetLocalTm(NULL)->tm_wday + 1; }
  83. _AFX_INLINE CTimeSpan CTime::operator-(CTime time) const
  84. { return CTimeSpan(m_time - time.m_time); }
  85. _AFX_INLINE CTime CTime::operator-(CTimeSpan timeSpan) const
  86. { return CTime(m_time - timeSpan.m_timeSpan); }
  87. _AFX_INLINE CTime CTime::operator+(CTimeSpan timeSpan) const
  88. { return CTime(m_time + timeSpan.m_timeSpan); }
  89. _AFX_INLINE const CTime& CTime::operator+=(CTimeSpan timeSpan)
  90. { m_time += timeSpan.m_timeSpan; return *this; }
  91. _AFX_INLINE const CTime& CTime::operator-=(CTimeSpan timeSpan)
  92. { m_time -= timeSpan.m_timeSpan; return *this; }
  93. _AFX_INLINE BOOL CTime::operator==(CTime time) const
  94. { return m_time == time.m_time; }
  95. _AFX_INLINE BOOL CTime::operator!=(CTime time) const
  96. { return m_time != time.m_time; }
  97. _AFX_INLINE BOOL CTime::operator<(CTime time) const
  98. { return m_time < time.m_time; }
  99. _AFX_INLINE BOOL CTime::operator>(CTime time) const
  100. { return m_time > time.m_time; }
  101. _AFX_INLINE BOOL CTime::operator<=(CTime time) const
  102. { return m_time <= time.m_time; }
  103. _AFX_INLINE BOOL CTime::operator>=(CTime time) const
  104. { return m_time >= time.m_time; }
  105. /////////////////////////////////////////////////////////////////////////////
  106. #endif //_AFX_INLINE