mars_lib  0.1.0.3dc76ee85e09
Modular and Robust Sensor-Fusion
time.h
Go to the documentation of this file.
1 // Copyright (C) 2021 Christian Brommer, Control of Networked Systems, University of Klagenfurt, Austria.
2 //
3 // All rights reserved.
4 //
5 // This software is licensed under the terms of the BSD-2-Clause-License with
6 // no commercial use allowed, the full terms of which are made available
7 // in the LICENSE file. No license in patents is granted.
8 //
9 // You can contact the author at <christian.brommer@ieee.org>
10 
11 #ifndef TIME_H
12 #define TIME_H
13 
14 #include <ctime>
15 #include <iostream>
16 
17 namespace mars
18 {
19 class Time
20 {
21 public:
22  Time() = default;
23  Time(const double& seconds);
24 
25  static Time get_time_now();
26 
27  double get_seconds() const;
28  Time abs() const;
29 
30  Time operator+(const Time& rhs) const;
31  Time operator-(const Time& rhs) const;
32  bool operator==(const Time& rhs) const;
33  bool operator<(const Time& rhs) const;
34  bool operator<=(const Time& rhs) const;
35  bool operator>(const Time& rhs) const;
36  bool operator>=(const Time& rhs) const;
37 
38  friend std::ostream& operator<<(std::ostream& out, const Time& data);
39 
40 private:
41  double seconds_{ 0.0 };
42 };
43 } // namespace mars
44 #endif // TIME_H
Definition: time.h:20
bool operator>=(const Time &rhs) const
double seconds_
Definition: time.h:41
Time()=default
double get_seconds() const
bool operator==(const Time &rhs) const
static Time get_time_now()
Time abs() const
Time operator-(const Time &rhs) const
bool operator<(const Time &rhs) const
bool operator>(const Time &rhs) const
bool operator<=(const Time &rhs) const
Time operator+(const Time &rhs) const
friend std::ostream & operator<<(std::ostream &out, const Time &data)
Time(const double &seconds)
Definition: buffer.h:27