USRP Hardware Driver and USRP Manual  Version: 3.11.0.HEAD-0-g13c32cef
UHD and USRP Manual
time_spec.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2012 Ettus Research LLC
3 // Copyright 2018 Ettus Research, a National Instruments Company
4 //
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 
8 #ifndef INCLUDED_UHD_TYPES_TIME_SPEC_HPP
9 #define INCLUDED_UHD_TYPES_TIME_SPEC_HPP
10 
11 #include <uhd/config.hpp>
12 #include <boost/operators.hpp>
13 #include <ctime>
14 
15 namespace uhd{
16 
29  class UHD_API time_spec_t : boost::additive<time_spec_t>, boost::totally_ordered<time_spec_t>{
30  public:
31 
38  static time_spec_t get_system_time(void);
39 
44  time_spec_t(double secs = 0);
45 
51  time_spec_t(time_t full_secs, double frac_secs = 0);
52 
60  time_spec_t(time_t full_secs, long tick_count, double tick_rate);
61 
68  static time_spec_t from_ticks(long long ticks, double tick_rate);
69 
76  long get_tick_count(double tick_rate) const;
77 
84  long long to_ticks(const double tick_rate) const;
85 
92  double get_real_secs(void) const;
93 
98  time_t get_full_secs(void) const;
99 
104  double get_frac_secs(void) const;
105 
107  time_spec_t &operator+=(const time_spec_t &);
108 
110  time_spec_t &operator-=(const time_spec_t &);
111 
112  //private time storage details
113  private: time_t _full_secs; double _frac_secs;
114  };
115 
117  UHD_API bool operator==(const time_spec_t &, const time_spec_t &);
118 
120  UHD_API bool operator<(const time_spec_t &, const time_spec_t &);
121 
123  return this->_full_secs;
124  }
125 
127  return this->_frac_secs;
128  }
129 
130 } //namespace uhd
131 
132 #endif /* INCLUDED_UHD_TYPES_TIME_SPEC_HPP */
Definition: time_spec.hpp:29
Definition: build_info.hpp:14
#define UHD_INLINE
Definition: config.h:53
UHD_API bool operator<(const time_spec_t &, const time_spec_t &)
Implement less_than_comparable interface.
#define UHD_API
Definition: config.h:63
double get_frac_secs(void) const
Definition: time_spec.hpp:126
UHD_API bool operator==(const time_spec_t &, const time_spec_t &)
Implement equality_comparable interface.
time_t get_full_secs(void) const
Definition: time_spec.hpp:122