TUIO C++ Developer API
TuioTime.h
1 /*
2  TUIO C++ Library
3  Copyright (c) 2005-2017 Martin Kaltenbrunner <martin@tuio.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 3.0 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library.
17 */
18 
19 #ifndef INCLUDED_TUIOTIME_H
20 #define INCLUDED_TUIOTIME_H
21 
22 #include "LibExport.h"
23 
24 #ifdef WIN32
25 #include <windows.h>
26 #include <ctime>
27 #else
28 #include <pthread.h>
29 #include <sys/time.h>
30 #endif
31 
32 #define MSEC_SECOND 1000
33 #define USEC_SECOND 1000000
34 #define USEC_MILLISECOND 1000
35 
36 namespace TUIO {
37 
48  class LIBDECL TuioTime {
49 
50  private:
51  long seconds;
52  long micro_seconds;
53  static long start_seconds;
54  static long start_micro_seconds;
55 
56  public:
57 
62  TuioTime ():seconds(0),micro_seconds(0) {};
63 
67  ~TuioTime() {}
68 
75  TuioTime (long msec);
76 
84  TuioTime (long sec, long usec);
85 
92  TuioTime operator+(long us);
93 
100  TuioTime operator+(TuioTime ttime);
101 
108  TuioTime operator-(long us);
109 
116  TuioTime operator-(TuioTime ttime);
117 
118 
124  void operator=(TuioTime ttime);
125 
132  bool operator==(TuioTime ttime);
133 
140  bool operator!=(TuioTime ttime);
141 
145  void reset();
146 
151  long getSeconds() const;
152 
157  long getMicroseconds() const;
158 
163  long getTotalMilliseconds() const;
164 
168  static void initSession();
169 
174  static TuioTime getSessionTime();
175 
180  static TuioTime getStartTime();
181 
186  static TuioTime getSystemTime();
187  };
188 }
189 #endif /* INCLUDED_TUIOTIME_H */
Definition: TuioTime.h:48
~TuioTime()
Definition: TuioTime.h:67
Definition: FlashSender.h:166
TuioTime()
Definition: TuioTime.h:62