USRP Hardware Driver and USRP Manual  Version: 3.14.0.HEAD-0-g28fe2e2c
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 // 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 <stdint.h>
14 
15 namespace uhd{
16 
30  boost::additive<time_spec_t>,
31  boost::additive<time_spec_t, double>,
32  boost::totally_ordered<time_spec_t>{
33  public:
34 
39  time_spec_t(double secs = 0);
40 
46  time_spec_t(int64_t full_secs, double frac_secs = 0);
47 
55  time_spec_t(int64_t full_secs, long tick_count, double tick_rate);
56 
63  static time_spec_t from_ticks(long long ticks, double tick_rate);
64 
71  long get_tick_count(double tick_rate) const;
72 
79  long long to_ticks(const double tick_rate) const;
80 
87  double get_real_secs(void) const;
88 
93  int64_t get_full_secs(void) const;
94 
99  double get_frac_secs(void) const;
100 
102  time_spec_t &operator+=(const time_spec_t &);
103  time_spec_t &operator+=(double &);
105  time_spec_t &operator-=(const time_spec_t &);
106  time_spec_t &operator-=(double &);
107 
108  //private time storage details
109  private:
110  int64_t _full_secs;
111  double _frac_secs;
112  };
113 
115  UHD_API bool operator==(const time_spec_t &, const time_spec_t &);
116 
118  UHD_API bool operator<(const time_spec_t &, const time_spec_t &);
119 
121  return this->_full_secs;
122  }
123 
125  return this->_frac_secs;
126  }
127 
128 } //namespace uhd
129 
130 #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:68
double get_frac_secs(void) const
Definition: time_spec.hpp:124
UHD_API bool operator==(const time_spec_t &, const time_spec_t &)
Implement equality_comparable interface.
int64_t get_full_secs(void) const
Definition: time_spec.hpp:120