ReactOS  0.4.12-dev-102-g4b7f1e0
ATL::CTimeSpan Class Reference

#include <atltime.h>

Public Member Functions

 CTimeSpan () throw ()
 
 CTimeSpan (__time64_t time) throw ()
 
 CTimeSpan (LONG lDays, int nHours, int nMins, int nSecs) throw ()
 
CString Format (LPCSTR pFormat) const
 
CString Format (LPCTSTR pszFormat) const
 
CString Format (UINT nID) const
 
LONGLONG GetTotalHours () const throw ()
 
LONGLONG GetTotalMinutes () const throw ()
 
LONGLONG GetTotalSeconds () const throw ()
 
LONGLONG GetDays () const throw ()
 
LONG GetHours () const throw ()
 
LONG GetMinutes () const throw ()
 
LONG GetSeconds () const throw ()
 
__time64_t GetTimeSpan () const throw ()
 

Private Attributes

__time64_t m_nSpan
 

Detailed Description

Definition at line 22 of file atltime.h.

Constructor & Destructor Documentation

◆ CTimeSpan() [1/3]

ATL::CTimeSpan::CTimeSpan ( )
throw (
)
inline

Definition at line 26 of file atltime.h.

Referenced by ATL::CTime::operator-().

27  {
28  // leave uninitialized
29  }

◆ CTimeSpan() [2/3]

ATL::CTimeSpan::CTimeSpan ( __time64_t  time)
throw (
)
inline

Definition at line 31 of file atltime.h.

32  {
33  m_nSpan = time;
34  }
__u16 time
Definition: mkdosfs.c:366
__time64_t m_nSpan
Definition: atltime.h:24

◆ CTimeSpan() [3/3]

ATL::CTimeSpan::CTimeSpan ( LONG  lDays,
int  nHours,
int  nMins,
int  nSecs 
)
throw (
)
inline

Definition at line 36 of file atltime.h.

37  {
38  ATLASSERT(lDays >= 0 && nHours >= 0 && nHours <= 23 && nMins >= 0 && nMins <= 59 && nSecs >= 0 && nSecs <= 59);
39  m_nSpan = ((((LONGLONG)lDays) * 24 + nHours) * 60 + nMins) * 60 + nSecs;
40  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
int64_t LONGLONG
Definition: typedefs.h:66
__time64_t m_nSpan
Definition: atltime.h:24

Member Function Documentation

◆ Format() [1/3]

CString ATL::CTimeSpan::Format ( LPCSTR  pFormat) const
inline

Definition at line 42 of file atltime.h.

43  {
44  struct tm time;
46  CStringA strTime;
47  strftime(strTime.GetBuffer(256), 256, pFormat, &time);
48  strTime.ReleaseBuffer();
49  return CString(strTime);
50  }
_CRTIMP errno_t __cdecl _localtime64_s(_Out_ struct tm *_Tm, _In_ const __time64_t *_Time)
__u16 time
Definition: mkdosfs.c:366
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:372
size_t CDECL strftime(char *str, size_t max, const char *format, const struct tm *mstm)
Definition: strftime.c:293
CStringA CString
Definition: atlstr.h:139
__time64_t m_nSpan
Definition: atltime.h:24
Definition: time.h:76

◆ Format() [2/3]

CString ATL::CTimeSpan::Format ( LPCTSTR  pszFormat) const
inline

Definition at line 52 of file atltime.h.

53  {
54  struct tm time;
56  CString strTime;
57 #ifdef UNICODE
58  wcsftime(strTime.GetBuffer(256), 256, pszFormat, &time);
59 #else
60  strftime(strTime.GetBuffer(256), 256, pszFormat, &time);
61 #endif
62  strTime.ReleaseBuffer();
63  return strTime;
64  }
_CRTIMP errno_t __cdecl _localtime64_s(_Out_ struct tm *_Tm, _In_ const __time64_t *_Time)
__u16 time
Definition: mkdosfs.c:366
size_t CDECL wcsftime(wchar_t *str, size_t max, const wchar_t *format, const struct tm *mstm)
Definition: strftime.c:302
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:372
size_t CDECL strftime(char *str, size_t max, const char *format, const struct tm *mstm)
Definition: strftime.c:293
__time64_t m_nSpan
Definition: atltime.h:24
Definition: time.h:76

◆ Format() [3/3]

CString ATL::CTimeSpan::Format ( UINT  nID) const
inline

Definition at line 66 of file atltime.h.

67  {
68  struct tm time;
70  CString strFormat;
71  strFormat.LoadString(nID);
72  CString strTime;
73 #ifdef UNICODE
74  wcsftime(strTime.GetBuffer(256), 256, strFormat, &time);
75 #else
76  strftime(strTime.GetBuffer(256), 256, strFormat, &time);
77 #endif
78  strTime.ReleaseBuffer();
79  return strTime;
80  }
_CRTIMP errno_t __cdecl _localtime64_s(_Out_ struct tm *_Tm, _In_ const __time64_t *_Time)
__u16 time
Definition: mkdosfs.c:366
size_t CDECL wcsftime(wchar_t *str, size_t max, const wchar_t *format, const struct tm *mstm)
Definition: strftime.c:302
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:372
size_t CDECL strftime(char *str, size_t max, const char *format, const struct tm *mstm)
Definition: strftime.c:293
__time64_t m_nSpan
Definition: atltime.h:24
Definition: time.h:76
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:506

◆ GetDays()

LONGLONG ATL::CTimeSpan::GetDays ( ) const
throw (
)
inline

Definition at line 97 of file atltime.h.

Referenced by GetHours().

98  {
99  return m_nSpan / 60 / 60 / 24;
100  }
__time64_t m_nSpan
Definition: atltime.h:24

◆ GetHours()

LONG ATL::CTimeSpan::GetHours ( ) const
throw (
)
inline

Definition at line 102 of file atltime.h.

103  {
104  return GetTotalHours() - GetDays() * 24;
105  }
LONGLONG GetDays() const
Definition: atltime.h:97
LONGLONG GetTotalHours() const
Definition: atltime.h:82

◆ GetMinutes()

LONG ATL::CTimeSpan::GetMinutes ( ) const
throw (
)
inline

Definition at line 107 of file atltime.h.

108  {
109  return GetTotalMinutes() - GetTotalHours() * 60;
110  }
LONGLONG GetTotalMinutes() const
Definition: atltime.h:87
LONGLONG GetTotalHours() const
Definition: atltime.h:82

◆ GetSeconds()

LONG ATL::CTimeSpan::GetSeconds ( ) const
throw (
)
inline

Definition at line 112 of file atltime.h.

113  {
114  return GetTotalSeconds() - GetTotalMinutes() * 60;
115  }
LONGLONG GetTotalMinutes() const
Definition: atltime.h:87
LONGLONG GetTotalSeconds() const
Definition: atltime.h:92

◆ GetTimeSpan()

__time64_t ATL::CTimeSpan::GetTimeSpan ( ) const
throw (
)
inline

Definition at line 117 of file atltime.h.

118  {
119  return m_nSpan;
120  }
__time64_t m_nSpan
Definition: atltime.h:24

◆ GetTotalHours()

LONGLONG ATL::CTimeSpan::GetTotalHours ( ) const
throw (
)
inline

Definition at line 82 of file atltime.h.

Referenced by GetHours(), and GetMinutes().

83  {
84  return m_nSpan / 60 / 60;
85  }
__time64_t m_nSpan
Definition: atltime.h:24

◆ GetTotalMinutes()

LONGLONG ATL::CTimeSpan::GetTotalMinutes ( ) const
throw (
)
inline

Definition at line 87 of file atltime.h.

Referenced by GetMinutes(), and GetSeconds().

88  {
89  return m_nSpan / 60;
90  }
__time64_t m_nSpan
Definition: atltime.h:24

◆ GetTotalSeconds()

LONGLONG ATL::CTimeSpan::GetTotalSeconds ( ) const
throw (
)
inline

Definition at line 92 of file atltime.h.

Referenced by GetSeconds().

93  {
94  return m_nSpan;
95  }
__time64_t m_nSpan
Definition: atltime.h:24

Member Data Documentation

◆ m_nSpan

__time64_t ATL::CTimeSpan::m_nSpan
private

Definition at line 24 of file atltime.h.

Referenced by GetTimeSpan(), ATL::CFileTimeSpan::GetTimeSpan(), and GetTotalSeconds().


The documentation for this class was generated from the following file: