Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
XTime.h
1// CXTime.h: interface for the CXTime class.
2//
3//////////////////////////////////////////////////////////////////////
4
5#if !defined(CXTIME_INCLUDE_H)
6#define CXTIME_INCLUDE_H
7
8#ifdef _MSC_VER
9#pragma once
10#endif // _MSC_VER
11
12BEGIN_MOOTOOLS_NAMESPACE
13
14DLL_TOOLSFUNCTION longint timeGetTick(); // longint allows signed substration
15
16class CXDuration;
17 class DLL_TOOLSFUNCTION CXTime
18 {
19 public:
20 static CXTime GetCurrentTime();
21
22 CXTime();
23 CXTime(xTime time);
24 CXTime(const tm *tmtime); // init with tm, throw an exception if tmtime is invalid
25 CXTime(int nYear, int nMonth, int nDay, int nHour, int nMin = 0, int nSec = 0, int nDST = -1); // init with provided information, throw an exception if convertion is invalid
26
27 CXTime& operator=(xTime time);
28 CXDuration operator-(const CXTime& time) const throw();
29 CXTime operator-(const CXDuration& duration) const throw();
30 CXTime operator+(const CXDuration& duration) const throw();
31
32 CXTime& operator+=(const CXDuration& duration) throw();
33 CXTime& operator-=(const CXDuration& duration) throw();
34
35 bool operator==(CXTime time) const;
36 bool operator!=(CXTime time) const;
37 bool operator<(CXTime time) const;
38 bool operator>(CXTime time) const;
39 bool operator<=(CXTime time) const;
40 bool operator>=(CXTime time) const;
41
42 bool GetUTCTm(struct tm* ptm) const; // Convert to UTC tm. Return true if successful, false otherwise
43 bool GetLocalTm(struct tm* ptm) const; // Convert to local time zone tm. Return true if successful, false otherwise
44
45 int GetYear() const;
46 int GetMonth() const;
47 int GetDay() const;
48 int GetHour() const;
49 int GetMinute() const;
50 int GetSecond() const;
51 int GetDayOfWeek() const;
52
53 int GetElapsedDays() const; // Get time diff if we performed some operation between two CXTime
54
55 xTime GetTime() const;
56
57 // formatting using "C" strftime
58 CXString Format(LPCTSTR pszFormat) const;
59 CXString FormatGmt(LPCTSTR pszFormat) const;
60
61#ifndef MOOTOOLS_NO_ARCHIVE_SUPPORT
62 virtual void Serialize(CXArchive& ar);
63#endif
64
65 #ifdef _DEBUG
66 void Dump() const;
67 #endif
68
69protected:
70 xTime m_time;
71};
72
73inline xTime CXTime::GetTime() const
74{
75 return m_time;
76}
77
78class DLL_TOOLSFUNCTION CXDuration
79{
80public:
81 CXDuration() throw();
82 CXDuration(xTime time) throw();
83 CXDuration(int days, int hours, int mins, int secs) throw();
84
85 longint GetDays() const throw();
86 longint GetTotalHours() const throw();
87 longint GetHours() const throw();
88 longint GetTotalMinutes() const throw();
89 longint GetMinutes() const throw();
90 longint GetTotalSeconds() const throw();
91 longint GetSeconds() const throw();
92
93 xTime GetDuration() const throw();
94
95 CXDuration operator+(const CXDuration& refduration) const throw();
96 CXDuration operator-(const CXDuration&refduration) const throw();
97 CXDuration& operator+=(const CXDuration& refduration) throw();
98 CXDuration& operator-=(const CXDuration& refduration) throw();
99 bool operator==(const CXDuration& refduration) const throw();
100 bool operator!=(const CXDuration& refduration) const throw();
101 bool operator<(const CXDuration& refduration) const throw();
102 bool operator>(const CXDuration& refduration) const throw();
103 bool operator<=(const CXDuration& refduration) const throw();
104 bool operator>=(const CXDuration& refduration) const throw();
105
106 private:
107 xTime duration;
108};
109
110END_MOOTOOLS_NAMESPACE
111
112#endif // !defined(CXTIME_INCLUDE_H)
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27
Definition XArchive.h:17
Definition XTime.h:79
Definition XTime.h:18