VectorNav C Library
time.h
Go to the documentation of this file.
1 
7 #ifndef _VNTIME_H_
8 #define _VNTIME_H_
9 
10 #include "vn/int.h"
11 #include "vn/error.h"
12 #include "vn/enum.h"
13 
14 #ifdef _WIN32
15 
16  /* Disable some warnings for Visual Studio with -Wall. */
17  #if defined(_MSC_VER)
18  #pragma warning(push)
19  #pragma warning(disable:4668)
20  #pragma warning(disable:4820)
21  #pragma warning(disable:4255)
22  #endif
23 
24  #include <Windows.h>
25 
26  #if defined(_MSC_VER)
27  #pragma warning(pop)
28  #endif
29 
30 #endif
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
37 typedef struct
38 {
39  #if _WIN32
40  double pcFrequency;
41  __int64 counterStart;
42  #elif __linux__ || __APPLE__ ||__CYGWIN__ || __QNXNTO__
43  double clockStart;
44  #else
45  #error "Unknown System"
46  #endif
47 } VnStopwatch;
48 
54 
59 VnError VnStopwatch_reset(VnStopwatch *stopwatch);
60 
67 VnError VnStopwatch_elapsedMs(VnStopwatch *stopwatch, float *elapsedMs);
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif
Provides simple timing capabilities.
Definition: time.h:37
VnError VnStopwatch_reset(VnStopwatch *stopwatch)
Resets the stopwatch's timing.
VnError VnStopwatch_initializeAndStart(VnStopwatch *stopwatch)
Initializes and starts a stopwatch.
VnError VnStopwatch_elapsedMs(VnStopwatch *stopwatch, float *elapsedMs)
Determines the number of milliseconds elapsed since the last reset of the stopwatch.