libutil++  1.9.3
 All Classes Functions Variables
TimeStamp.h
1 /*
2 ** libutil++
3 ** $Id: TimeStamp.h 1653 2016-02-28 19:54:59Z sella $
4 ** Copyright (c) 2011-2016 Digital Genesis, LLC. All Rights Reserved.
5 ** Released under the LGPL Version 2.1 License.
6 ** http://www.digitalgenesis.com
7 */
8 
9 #ifndef __libutilxx__sella__util__TimeStamp_H__
10 #define __libutilxx__sella__util__TimeStamp_H__
11 
12 #include "../../common.h"
13 
14 #include <sys/time.h>
15 #include <stdint.h>
16 
17 namespace sella {
18  namespace util {
19  class TimeStamp;
20  }
21 }
22 
24  public:
25  TimeStamp(const struct timeval &tv) throw ();
26  TimeStamp(int64_t micro) throw ();
27  TimeStamp() throw ();
28 
29  TimeStamp(const TimeStamp &other) throw ();
30  virtual ~TimeStamp() throw ();
31 
32  TimeStamp & operator = (const TimeStamp &other) throw ();
33  TimeStamp & operator = (const struct timeval &value) throw ();
34  TimeStamp & operator = (int64_t micro) throw ();
35 
36  TimeStamp & operator += (const TimeStamp &other) throw ();
37  TimeStamp & operator += (const struct timeval &value) throw ();
38  TimeStamp & operator += (int64_t micro) throw ();
39 
40  TimeStamp & operator -= (const TimeStamp &other) throw ();
41  TimeStamp & operator -= (const struct timeval &value) throw ();
42  TimeStamp & operator -= (int64_t micro) throw ();
43 
44  TimeStamp & operator *= (const TimeStamp &other) throw ();
45  TimeStamp & operator *= (const struct timeval &value) throw ();
46  TimeStamp & operator *= (int64_t micro) throw ();
47 
48  TimeStamp & operator /= (const TimeStamp &other) throw ();
49  TimeStamp & operator /= (const struct timeval &value) throw ();
50  TimeStamp & operator /= (int64_t micro) throw ();
51 
52  TimeStamp operator + (const TimeStamp &other) throw ();
53  TimeStamp operator + (const struct timeval &value) throw ();
54  TimeStamp operator + (int64_t micro) throw ();
55 
56  TimeStamp operator - (const TimeStamp &other) throw ();
57  TimeStamp operator - (const struct timeval &value) throw ();
58  TimeStamp operator - (int64_t micro) throw ();
59 
60  TimeStamp operator * (const TimeStamp &other) throw ();
61  TimeStamp operator * (const struct timeval &value) throw ();
62  TimeStamp operator * (int64_t micro) throw ();
63 
64  TimeStamp operator / (const TimeStamp &other) throw ();
65  TimeStamp operator / (const struct timeval &value) throw ();
66  TimeStamp operator / (int64_t micro) throw ();
67 
68  bool operator == (const TimeStamp &other) const throw ();
69  bool operator != (const TimeStamp &other) const throw ();
70  bool operator >= (const TimeStamp &other) const throw ();
71  bool operator <= (const TimeStamp &other) const throw ();
72  bool operator > (const TimeStamp &other) const throw ();
73  bool operator < (const TimeStamp &other) const throw ();
74 
75  int64_t getEpochMicroseconds() const throw ();
76  int64_t getEpochSeconds() const throw ();
77 
78  void update() throw ();
79 
80  private:
81  static int64_t now() throw ();
82 
83  int64_t stamp;
84 };
85 
86 #endif
87 
88 /*
89 ** vim: noet ts=3 sw=3
90 */