cprover
time_stopping.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Time Stopping
4 
5 Author: Daniel Kroening
6 
7 Date: February 2004
8 
9 \*******************************************************************/
10 
13 
14 #ifndef CPROVER_UTIL_TIME_STOPPING_H
15 #define CPROVER_UTIL_TIME_STOPPING_H
16 
17 #include <iosfwd>
18 #include <string>
19 
21 {
22 public:
24  {
25  }
26 
27  explicit fine_timet(unsigned long long _t):t(_t)
28  {
29  }
30 
31  unsigned long long get_t() const
32  {
33  return t;
34  }
35 
36  void clear()
37  {
38  t=0;
39  }
40 
41 protected:
42  unsigned long long t;
43 };
44 
46 {
47 public:
49  {
50  }
51 
52  explicit time_periodt(unsigned long long _t):fine_timet(_t)
53  {
54  }
55 
56  std::string as_string() const;
57 
59  {
60  t+=other.t;
61  return *this;
62  }
63 
65  {
66  time_periodt tmp=*this;
67  tmp.t+=other.t;
68  return tmp;
69  }
70 
72  {
73  return time_periodt(t-other.t);
74  }
75 };
76 
78 {
79 public:
81  {
82  }
83 
84  explicit absolute_timet(unsigned long long _t):fine_timet(_t)
85  {
86  }
87 
89  {
90  return time_periodt(t-other.t);
91  }
92 };
93 
95 
96 std::ostream &operator << (std::ostream &, const time_periodt &);
97 
98 #endif // CPROVER_UTIL_TIME_STOPPING_H
time_periodt operator-(const time_periodt &other)
Definition: time_stopping.h:71
std::string as_string() const
time_periodt operator-(const absolute_timet &other)
Definition: time_stopping.h:88
fine_timet(unsigned long long _t)
Definition: time_stopping.h:27
time_periodt & operator+=(const time_periodt &other)
Definition: time_stopping.h:58
absolute_timet(unsigned long long _t)
Definition: time_stopping.h:84
unsigned long long get_t() const
Definition: time_stopping.h:31
absolute_timet current_time()
void clear()
Definition: time_stopping.h:36
time_periodt operator+(const time_periodt &other)
Definition: time_stopping.h:64
std::ostream & operator<<(std::ostream &, const time_periodt &)
unsigned long long t
Definition: time_stopping.h:42
time_periodt(unsigned long long _t)
Definition: time_stopping.h:52