Loading...
Searching...
No Matches
time_spec.hpp
Go to the documentation of this file.
//
// Copyright 2010-2012 Ettus Research LLC
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include <uhd/config.hpp>
#include <stdint.h>
#include <boost/operators.hpp>
namespace uhd {
class UHD_API time_spec_t : boost::additive<time_spec_t>,
boost::additive<time_spec_t, double>,
boost::totally_ordered<time_spec_t>
{
public:
// A special value that signifies immediate execution
static constexpr double ASAP = 0.0;
time_spec_t(double secs = 0);
time_spec_t(int64_t full_secs, double frac_secs = 0);
time_spec_t(int64_t full_secs, long tick_count, double tick_rate);
static time_spec_t from_ticks(long long ticks, double tick_rate);
long get_tick_count(double tick_rate) const;
long long to_ticks(const double tick_rate) const;
double get_real_secs(void) const;
int64_t get_full_secs(void) const;
double get_frac_secs(void) const;
time_spec_t& operator+=(const time_spec_t&);
time_spec_t& operator+=(double&);
time_spec_t& operator-=(const time_spec_t&);
time_spec_t& operator-=(double&);
// private time storage details
private:
int64_t _full_secs;
double _frac_secs;
};
UHD_API bool operator==(const time_spec_t&, const time_spec_t&);
UHD_API bool operator<(const time_spec_t&, const time_spec_t&);
UHD_INLINE int64_t time_spec_t::get_full_secs(void) const
{
return this->_full_secs;
}
UHD_INLINE double time_spec_t::get_frac_secs(void) const
{
return this->_frac_secs;
}
} // namespace uhd
uhd::time_spec_t
Definition time_spec.hpp:31
uhd::time_spec_t::get_full_secs
int64_t get_full_secs(void) const
Definition time_spec.hpp:121
uhd::time_spec_t::get_tick_count
long get_tick_count(double tick_rate) const
uhd::time_spec_t::time_spec_t
time_spec_t(double secs=0)
uhd::time_spec_t::operator+=
time_spec_t & operator+=(double &)
uhd::time_spec_t::operator+=
time_spec_t & operator+=(const time_spec_t &)
Implement addable interface.
uhd::time_spec_t::get_frac_secs
double get_frac_secs(void) const
Definition time_spec.hpp:126
uhd::time_spec_t::ASAP
static constexpr double ASAP
Definition time_spec.hpp:34
uhd::time_spec_t::time_spec_t
time_spec_t(int64_t full_secs, long tick_count, double tick_rate)
uhd::time_spec_t::operator-=
time_spec_t & operator-=(double &)
uhd::time_spec_t::get_real_secs
double get_real_secs(void) const
uhd::time_spec_t::from_ticks
static time_spec_t from_ticks(long long ticks, double tick_rate)
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-=(const time_spec_t &)
Implement subtractable interface.
uhd::time_spec_t::to_ticks
long long to_ticks(const double tick_rate) const
UHD_INLINE
#define UHD_INLINE
Definition config.h:65
UHD_API
#define UHD_API
Definition config.h:87
config.hpp
uhd
Definition build_info.hpp:12
uhd::operator==
UHD_API bool operator==(const time_spec_t &, const time_spec_t &)
Implement equality_comparable interface.
uhd::operator<
UHD_API bool operator<(const time_spec_t &, const time_spec_t &)
Implement less_than_comparable interface.