2
* Copyright 2010 Inalogic Inc.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3, as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the applicable version of the GNU Lesser General Public
12
* License for more details.
14
* You should have received a copy of both the GNU Lesser General Public
15
* License version 3 along with this program. If not, see
16
* <http://www.gnu.org/licenses/>
18
* Authored by: Jay Taoko <jay.taoko_AT_gmail_DOT_com>
28
// Store time from [Midnight(00:00:00), January 1, 1970 UTC] up to [23:59:59, December 31, 3000 UTC] or [03:14:07 January 19, 2038 UTC]
36
unsigned int m_Year; /* year */
37
unsigned int m_Month; /* months since January - [0,11] */
38
unsigned int m_Day; /* day of the month - [1,31] */
39
unsigned int m_Hour; /* hours since midnight - [0,23] */
40
unsigned int m_Minute; /* minutes after the hour - [0,59] */
41
unsigned int m_Second; /* seconds after the minute - [0,59]*/
42
//unsigned int m_DayOfWeek; /* days since Sunday - [0,6] */
43
//unsigned int m_DayOfYear; /* days since January 1 - [0,365] */
44
unsigned int m_MicroSecond;
46
t_s64 GetJulianDayNumber() const;
47
t_f64 GetJulianDate() const;
48
unsigned int GetSecondOfDay() const;
49
bool operator== ( NTimeStamp &Other ) const;
50
bool operator!= ( NTimeStamp &Other ) const;
51
bool operator< ( NTimeStamp &Other ) const;
52
bool operator> ( NTimeStamp &Other ) const;
53
bool operator>= ( NTimeStamp &Other ) const;
54
bool operator<= ( NTimeStamp &Other ) const;
59
//! Returns the number of cycles that have passed. The origin is unknown.
61
Returns the number of cycles that have passed. The origin is unknown.
63
@return current value of high resolution cycle counter.
68
#define inl_clock(Timer) {Timer -= inlCycles();}
69
#define inl_unclock(Timer) {Timer += inlCycles();}
71
#define inl_clock(Timer)
72
#define inl_unclock(Timer)
76
//! Returns the time that has passed in seconds. The origin is unknown.
78
Returns the time that has passed in seconds. The origin is unknown.
80
@return the time passed in seconds.
84
//! Returns the time that has passed in milliseconds. The origin is unknown.
86
Returns the time that has passed in milliseconds. The origin is unknown.
88
@return the time passed in milliseconds.
90
double MilliSeconds();
92
// Retrieves the current local date and time.
93
void GetLocalTime (unsigned int &Year,
99
unsigned int &MicroSec);
101
// Retrieves the current system date and time. The system time is expressed in Coordinated Universal Time (UTC).
102
void GetUTCTime (unsigned int &Year,
108
unsigned int &MicroSec);
110
//! Returns the time formatted in a string
112
Returns the time formatted in a string.
114
const TCHAR *GetFormattedLocalTime();
116
//! Sleep the thread for Seconds.
118
Sleep the thread for Seconds.
119
A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run.
121
void SleepSeconds ( float Seconds );
123
//! Sleep the thread for MilliSeconds.
125
Sleep the thread for MilliSeconds.
126
A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run.
128
void SleepMilliSeconds ( float MilliSeconds );
130
//! Get the time zone in hours.
132
Get the time zone in hours. Estern North American time zone is -5 hours.
134
t_long GetTimeZone();
137
Suspend thread execution for an interval measured in microseconds.
139
@Milliseconds duration in Milliseconds.
141
void SleepForMilliseconds (unsigned int Milliseconds);