SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gettimeofday.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 */
10
11 #ifndef __GET_TIME_OF_DAY_H
12 #define __GET_TIME_OF_DAY_H
13
14 #if defined(_WIN32) && !defined(__GNUC__) &&!defined(__GCCXML__)
15 #include < time.h >
16 struct timezone
17 {
18 int tz_minuteswest; /* minutes W of Greenwich */
19 int tz_dsttime; /* type of dst correction */
20 };
21
22 #if defined(WINDOWS_STORE_RT)
23 struct timeval {
24 long tv_sec;
25 long tv_usec;
26 };
27 #endif
28
29 int gettimeofday(struct timeval *tv, struct timezone *tz);
30
31
32 #else
33
34
35
36
37 #include <sys/time.h>
38
39 #include <unistd.h>
40
41 // Uncomment this if you need to
42 /*
43 // http://www.halcode.com/archives/2008/08/26/retrieving-system-time-gettimeofday/
44 struct timezone
45 {
46 int tz_minuteswest;
47 int tz_dsttime;
48 };
49
50 #ifdef __cplusplus
51
52 void GetSystemTimeAsFileTime(FILETIME*);
53
54 inline int gettimeofday(struct timeval* p, void* tz )
55 {
56 union {
57 long long ns100; // time since 1 Jan 1601 in 100ns units
58 FILETIME ft;
59 } now;
60
61 GetSystemTimeAsFileTime( &(now.ft) );
62 p->tv_usec=(long)((now.ns100 / 10LL) % 1000000LL );
63 p->tv_sec= (long)((now.ns100-(116444736000000000LL))/10000000LL);
64 return 0;
65 }
66
67 #else
68 int gettimeofday(struct timeval* p, void* tz );
69 #endif
70 */
71
72 #endif
73
74 #endif