USRP Hardware Driver and USRP Manual  Version: 3.15.0.0-4+b1
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 <stdint.h>
13 #include <boost/operators.hpp>
14 
15 namespace uhd {
16 
29 class UHD_API time_spec_t : boost::additive<time_spec_t>,
30  boost::additive<time_spec_t, double>,
31  boost::totally_ordered<time_spec_t>
32 {
33 public:
38  time_spec_t(double secs = 0);
39 
45  time_spec_t(int64_t full_secs, double frac_secs = 0);
46 
54  time_spec_t(int64_t full_secs, long tick_count, double tick_rate);
55 
62  static time_spec_t from_ticks(long long ticks, double tick_rate);
63 
70  long get_tick_count(double tick_rate) const;
71 
78  long long to_ticks(const double tick_rate) const;
79 
86  double get_real_secs(void) const;
87 
92  int64_t get_full_secs(void) const;
93 
98  double get_frac_secs(void) const;
99 
106 
107  // private time storage details
108 private:
109  int64_t _full_secs;
110  double _frac_secs;
111 };
112 
115 
118 
120 {
121  return this->_full_secs;
122 }
123 
125 {
126  return this->_frac_secs;
127 }
128 
129 } // namespace uhd
130 
131 #endif /* INCLUDED_UHD_TYPES_TIME_SPEC_HPP */
uhd::time_spec_t::operator-=
time_spec_t & operator-=(const time_spec_t &)
Implement subtractable interface.
uhd::time_spec_t::get_frac_secs
double get_frac_secs(void) const
Definition: time_spec.hpp:124
uhd::operator<
UHD_API bool operator<(const time_spec_t &, const time_spec_t &)
Implement less_than_comparable interface.
config.hpp
uhd::time_spec_t::to_ticks
long long to_ticks(const double tick_rate) const
uhd::time_spec_t::get_real_secs
double get_real_secs(void) const
UHD_INLINE
#define UHD_INLINE
Definition: config.h:53
uhd::operator==
UHD_API bool operator==(const time_spec_t &, const time_spec_t &)
Implement equality_comparable interface.
UHD_API
#define UHD_API
Definition: config.h:68
uhd::time_spec_t::get_tick_count
long get_tick_count(double tick_rate) const
uhd
Definition: build_info.hpp:13
uhd::time_spec_t
Definition: time_spec.hpp:32
uhd::time_spec_t::operator+=
time_spec_t & operator+=(double &)
uhd::time_spec_t::time_spec_t
time_spec_t(int64_t full_secs, double frac_secs=0)
uhd::time_spec_t::operator-=
time_spec_t & operator-=(double &)
uhd::time_spec_t::time_spec_t
time_spec_t(double secs=0)
uhd::time_spec_t::get_full_secs
int64_t get_full_secs(void) const
Definition: time_spec.hpp:119
uhd::time_spec_t::from_ticks
static time_spec_t from_ticks(long long ticks, double tick_rate)
uhd::time_spec_t::operator+=
time_spec_t & operator+=(const time_spec_t &)
Implement addable interface.
uhd::time_spec_t::time_spec_t
time_spec_t(int64_t full_secs, long tick_count, double tick_rate)