UHD  003.001.002
time_spec.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2011 Ettus Research LLC
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef INCLUDED_UHD_TYPES_TIME_SPEC_HPP
19 #define INCLUDED_UHD_TYPES_TIME_SPEC_HPP
20 
21 #include <uhd/config.hpp>
22 #include <boost/operators.hpp>
23 #include <ctime>
24 
25 namespace uhd{
26 
39  class UHD_API time_spec_t : boost::additive<time_spec_t>, boost::totally_ordered<time_spec_t>{
40  public:
41 
47  static time_spec_t get_system_time(void);
48 
53  time_spec_t(double secs = 0);
54 
60  time_spec_t(time_t full_secs, double frac_secs = 0);
61 
69  time_spec_t(time_t full_secs, long tick_count, double tick_rate);
70 
77  long get_tick_count(double tick_rate) const;
78 
85  double get_real_secs(void) const;
86 
91  time_t get_full_secs(void) const;
92 
97  double get_frac_secs(void) const;
98 
100  time_spec_t &operator+=(const time_spec_t &);
101 
103  time_spec_t &operator-=(const time_spec_t &);
104 
105  //private time storage details
106  private: time_t _full_secs; double _frac_secs;
107  };
108 
110  UHD_API bool operator==(const time_spec_t &, const time_spec_t &);
111 
113  UHD_API bool operator<(const time_spec_t &, const time_spec_t &);
114 
115 } //namespace uhd
116 
117 #endif /* INCLUDED_UHD_TYPES_TIME_SPEC_HPP */
Definition: time_spec.hpp:39
#define UHD_API
Definition: config.hpp:76
Definition: convert.hpp:28
UHD_API bool operator<(const time_spec_t &, const time_spec_t &)
Implement less_than_comparable interface.
UHD_API bool operator==(const time_spec_t &, const time_spec_t &)
Implement equality_comparable interface.