Time.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <string>
9 #include <etk/types.hpp>
10 #include <chrono>
11 
12 namespace echrono {
13  class Duration;
17  class Time {
18  private:
19  std::chrono::system_clock::time_point m_data;
20  public:
21  Time();
22  //Time(const echrono::Duration& _val) {}; //value in second
23  Time(int64_t _valNano);
24  Time(int64_t _valSec, int64_t _valNano);
25  Time(const std::chrono::system_clock::time_point& _val);
26  ~Time() {};
27  const std::chrono::system_clock::time_point& get() const {
28  return m_data;
29  }
34  int64_t count();
38  static Time now();
39  const Time& operator= (const echrono::Time& _obj );
40  bool operator== (const echrono::Time& _obj) const;
41  bool operator!= (const echrono::Time& _obj) const;
42  bool operator< (const echrono::Time& _obj) const;
43  bool operator<= (const echrono::Time& _obj) const;
44  bool operator> (const echrono::Time& _obj) const;
45  bool operator>= (const echrono::Time& _obj) const;
46  const Time& operator+= (const echrono::Duration& _obj);
47  Time operator+ (const echrono::Duration& _obj) const;
48  const Time& operator-= (const echrono::Duration& _obj);
49  Time operator- (const echrono::Duration& _obj) const;
50  Duration operator- (const echrono::Time& _obj) const;
51  void reset();
52  };
53  std::ostream& operator <<(std::ostream& _os, const echrono::Time& _obj);
54 }
55 
int64_t count()
return the number od us since epoch (can be <0)
Represent the earth clock (if computer is synchronized)
Definition: Time.hpp:17
Definition: Duration.hpp:17
Definition: Clock.hpp:12
static Time now()
get the current time