~hikiko/nux/arb-srgba-shader

« back to all changes in this revision

Viewing changes to NuxCore/NTime.h

  • Committer: Neil Jagdish Patel
  • Date: 2010-09-01 19:25:37 UTC
  • Revision ID: neil.patel@canonical.com-20100901192537-mfz7rm6q262pewg6
Import and build NuxCore

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef NTIME_H
 
2
#define NTIME_H
 
3
 
 
4
NAMESPACE_BEGIN
 
5
// 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]
 
6
class NTimeStamp
 
7
{
 
8
public:
 
9
 
 
10
    NTimeStamp();
 
11
    ~NTimeStamp();
 
12
    // Time is in UTC
 
13
    unsigned int     m_Year;           /* year                             */
 
14
    unsigned int     m_Month;          /* months since January - [0,11]    */
 
15
    unsigned int     m_Day;            /* day of the month - [1,31]        */
 
16
    unsigned int     m_Hour;           /* hours since midnight - [0,23]    */
 
17
    unsigned int     m_Minute;         /* minutes after the hour - [0,59]  */
 
18
    unsigned int     m_Second;         /* seconds after the minute - [0,59]*/
 
19
    //unsigned int     m_DayOfWeek;      /* days since Sunday - [0,6]        */
 
20
    //unsigned int     m_DayOfYear;      /* days since January 1 - [0,365]   */
 
21
    unsigned int     m_MicroSecond;
 
22
 
 
23
    t_s64  GetJulianDayNumber()             const;
 
24
    t_f64  GetJulianDate()                  const;
 
25
    unsigned int    GetSecondOfDay()                 const;
 
26
    bool   operator==( NTimeStamp& Other )  const;
 
27
    bool   operator!=( NTimeStamp& Other )  const;
 
28
    bool   operator< ( NTimeStamp& Other )  const;
 
29
    bool   operator> ( NTimeStamp& Other )  const;
 
30
    bool   operator>=( NTimeStamp& Other )  const;
 
31
    bool   operator<=( NTimeStamp& Other )  const;
 
32
 
 
33
    void GetTime();
 
34
};
 
35
 
 
36
//! Returns the number of cycles that have passed. The origin is unknown.
 
37
/*!
 
38
    Returns the number of cycles that have passed. The origin is unknown.
 
39
 
 
40
    @return current value of high resolution cycle counter.
 
41
*/
 
42
DWORD inlCycles();
 
43
 
 
44
#if STATS
 
45
    #define inl_clock(Timer)   {Timer -= inlCycles();}
 
46
    #define inl_unclock(Timer) {Timer += inlCycles();}
 
47
#else
 
48
    #define inl_clock(Timer)
 
49
    #define inl_unclock(Timer)
 
50
#endif
 
51
 
 
52
 
 
53
//! Returns the time that has passed in seconds. The origin is unknown.
 
54
/*!
 
55
    Returns the time that has passed in seconds. The origin is unknown.
 
56
 
 
57
    @return the time passed in seconds.
 
58
*/
 
59
    double Seconds();
 
60
 
 
61
//! Returns the time that has passed in milliseconds. The origin is unknown.
 
62
/*!
 
63
    Returns the time that has passed in milliseconds. The origin is unknown.
 
64
 
 
65
    @return the time passed in milliseconds.
 
66
*/
 
67
    double MilliSeconds();
 
68
 
 
69
// Retrieves the current local date and time.
 
70
    void GetLocalTime(unsigned int& Year,
 
71
        unsigned int& Month,
 
72
        unsigned int& Day,
 
73
        unsigned int& Hour,
 
74
        unsigned int& Min,
 
75
        unsigned int& Sec,
 
76
        unsigned int& MicroSec);
 
77
 
 
78
// Retrieves the current system date and time. The system time is expressed in Coordinated Universal Time (UTC).
 
79
    void GetUTCTime(unsigned int& Year,
 
80
        unsigned int& Month,
 
81
        unsigned int& Day,
 
82
        unsigned int& Hour,
 
83
        unsigned int& Min,
 
84
        unsigned int& Sec,
 
85
        unsigned int& MicroSec);
 
86
 
 
87
//! Returns the time formatted in a string
 
88
/*!
 
89
    Returns the time formatted in a string.
 
90
*/
 
91
const TCHAR* GetFormattedLocalTime();
 
92
 
 
93
//! Sleep the thread for Seconds.
 
94
/*!
 
95
    Sleep the thread for Seconds.
 
96
    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.
 
97
*/
 
98
void SleepSeconds( float Seconds );
 
99
 
 
100
//! Sleep the thread for MilliSeconds.
 
101
/*!
 
102
    Sleep the thread for MilliSeconds.
 
103
    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.
 
104
*/
 
105
void SleepMilliSeconds( float MilliSeconds );
 
106
 
 
107
//! Get the time zone in hours.
 
108
/*!
 
109
    Get the time zone in hours. Estern North American time zone is -5 hours.
 
110
*/
 
111
t_long GetTimeZone();
 
112
 
 
113
/*!
 
114
    Suspend thread execution for an interval measured in microseconds.
 
115
 
 
116
    @Milliseconds duration in Milliseconds.
 
117
*/
 
118
void SleepForMilliseconds(unsigned int Milliseconds);
 
119
 
 
120
NAMESPACE_END
 
121
 
 
122
#endif // NTIME_H