USRP Hardware Driver and USRP Manual  Version: 3.11.0.HEAD-0-gdca39145
UHD and USRP Manual
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
time_spec.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2012 Ettus Research LLC
3 //
4 // SPDX-License-Identifier: GPL-3.0
5 //
6 
7 #ifndef INCLUDED_UHD_TYPES_TIME_SPEC_HPP
8 #define INCLUDED_UHD_TYPES_TIME_SPEC_HPP
9 
10 #include <uhd/config.hpp>
11 #include <boost/operators.hpp>
12 #include <ctime>
13 
14 namespace uhd{
15 
28  class UHD_API time_spec_t : boost::additive<time_spec_t>, boost::totally_ordered<time_spec_t>{
29  public:
30 
37  static time_spec_t get_system_time(void);
38 
43  time_spec_t(double secs = 0);
44 
50  time_spec_t(time_t full_secs, double frac_secs = 0);
51 
59  time_spec_t(time_t full_secs, long tick_count, double tick_rate);
60 
67  static time_spec_t from_ticks(long long ticks, double tick_rate);
68 
75  long get_tick_count(double tick_rate) const;
76 
83  long long to_ticks(const double tick_rate) const;
84 
91  double get_real_secs(void) const;
92 
97  time_t get_full_secs(void) const;
98 
103  double get_frac_secs(void) const;
104 
106  time_spec_t &operator+=(const time_spec_t &);
107 
109  time_spec_t &operator-=(const time_spec_t &);
110 
111  //private time storage details
112  private: time_t _full_secs; double _frac_secs;
113  };
114 
116  UHD_API bool operator==(const time_spec_t &, const time_spec_t &);
117 
119  UHD_API bool operator<(const time_spec_t &, const time_spec_t &);
120 
122  return this->_full_secs;
123  }
124 
126  return this->_frac_secs;
127  }
128 
129 } //namespace uhd
130 
131 #endif /* INCLUDED_UHD_TYPES_TIME_SPEC_HPP */
Definition: time_spec.hpp:28
Definition: build_info.hpp:14
#define UHD_INLINE
Definition: config.h:52
UHD_API bool operator<(const time_spec_t &, const time_spec_t &)
Implement less_than_comparable interface.
#define UHD_API
Definition: config.h:62
double get_frac_secs(void) const
Definition: time_spec.hpp:125
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:121