ReplicaNet and RNLobby  1
SysTime.h
1 /* START_LICENSE_HEADER
2 
3 Copyright (C) 2000 Martin Piper, original design and program code
4 Copyright (C) 2001 Replica Software
5 
6 This program file is copyright (C) Replica Software and can only be used under license.
7 For more information visit: http://www.replicanet.com/
8 Or email: info@replicanet.com
9 
10 END_LICENSE_HEADER */
11 #include "RNPlatform/Inc/MemoryTracking.h"
12 #ifndef __SYSTIME_H__
13 #define __SYSTIME_H__
14 
15 #if defined(_XBOX)
16 #include <xtl.h> // For XBox builds
17 #else
18 #if defined(_WIN32)
19 #include <windows.h> // For Windows builds
20 #endif
21 #endif
22 
23 #if defined(_PS2)
24 #include <eekernel.h>
25 #endif
26 
27 namespace RNReplicaNet
28 {
29 
30 #if !defined(REPLICANET_TIME_FLOAT) && !defined(REPLICANET_TIME_DOUBLE)
31 #define REPLICANET_TIME_DOUBLE
32 #endif
33 #ifdef REPLICANET_TIME_FLOAT
34 typedef float SysTimeType;
35 #endif
36 #ifdef REPLICANET_TIME_DOUBLE
37 typedef double SysTimeType;
38 #endif
39 
40 struct SystemTime
41 {
42  unsigned short wYear;
43  unsigned short wMonth;
44  unsigned short wDayOfWeek;
45  unsigned short wDay;
46  unsigned short wHour;
47  unsigned short wMinute;
48  unsigned short wSecond;
49  unsigned short wMilliseconds;
50 };
51 
55 class SysTime
56 {
57 public:
58 
62  SysTime();
63 
67  virtual ~SysTime();
68 
73  SysTimeType FloatTime(void);
74 
78  static unsigned int GetTickCount(void);
79 
83  void Reset(void);
84 
86  static void GetSystemTime(SystemTime *sysTime);
87 
88 private:
89 #if defined(_WIN32)
90  double pfreq;
91  double curtime;
92  double lastcurtime;
93  int lowshift;
94  int sametimecount;
95  unsigned int oldtime;
96 
97 
98  LARGE_INTEGER startticktime;
99  LARGE_INTEGER PerformanceFreq;
100 #endif
101 #if defined(_PS2)
102  u_long mPS2Initial;
103 #endif
104  int first;
105  unsigned int mBaseTickCount;
106  int mSecBase;
107 };
108 
109 } // namespace RNReplicaNet
110 
111 #endif //#ifndef __SYSTIME_H__
Definition: SysTime.h:40
static unsigned int GetTickCount(void)
static void GetSystemTime(SystemTime *sysTime)
A replacement for the Win32 API GetSystemTime() and struct SYSTEMTIME.
SysTimeType FloatTime(void)
Definition: SysTime.h:55