HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SYS_Time.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: SYS_Time.h (SYS Library, C++)
7  *
8  * COMMENTS: Platform-independent time structures
9  */
10 
11 #ifndef __SYS_TIME_H_INCLUDED__
12 #define __SYS_TIME_H_INCLUDED__
13 
14 #include "SYS_API.h"
15 #include "SYS_Types.h"
16 #include <time.h>
17 
18 #ifdef WIN32
19 struct SYS_TimeVal
20 {
21  exint tv_sec; /* seconds */
22  exint tv_usec; /* and microseconds */
23 };
24 
25 #define timegm _mkgmtime
26 
27 #else
28 
29 #include <sys/time.h>
30 
31 typedef struct timeval SYS_TimeVal;
32 
33 #endif
34 
35 // SYSgettimeofday() fills in tval with the "current" time, which cannot be
36 // given any particular meaning. These values are only useful for comparing
37 // against each other.
39 
40 // Return a number of milliseconds since the process started. This function
41 // will wrap values every 50 days or so.
42 SYS_API time_t SYSclock();
43 
44 // Return the number of seconds since some arbitrary start time as a real
45 // number. Returns -1 if there was an error computing the time.
47 
48 // Return the number of seconds expressed in the given time value.
49 SYS_API fpreal SYStime(const SYS_TimeVal &tval);
50 
51 /// Return the system resource usage times (user and system) for the current
52 /// process.
53 SYS_API void SYSrusage(SYS_TimeVal &user, SYS_TimeVal &sys);
54 
55 #endif // __SYS_TIME_H_INCLUDED__
struct timeval SYS_TimeVal
Definition: SYS_Time.h:31
int64 exint
Definition: SYS_Types.h:125
SYS_API int SYSgettimeofday(SYS_TimeVal *tval)
SYS_API time_t SYSclock()
SYS_API void SYSrusage(SYS_TimeVal &user, SYS_TimeVal &sys)
SYS_API fpreal SYStime()
fpreal64 fpreal
Definition: SYS_Types.h:277
#define SYS_API
Definition: SYS_API.h:11