diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-08-16 14:25:24 -0700 |
---|---|---|
committer | Brent Stapleton <bstapleton@g.hmc.edu> | 2018-08-20 16:56:43 -0700 |
commit | 8e3ea14c9406f3f3e5fe613bfe59906447a195e0 (patch) | |
tree | 9e7924432f7c3be99693faed5478a8b95c3ecb97 /host/include | |
parent | 3b42e6f029f0d3de0f54d720964357aa0a32986f (diff) | |
download | uhd-8e3ea14c9406f3f3e5fe613bfe59906447a195e0.tar.gz uhd-8e3ea14c9406f3f3e5fe613bfe59906447a195e0.tar.bz2 uhd-8e3ea14c9406f3f3e5fe613bfe59906447a195e0.zip |
uhd: Remove usage of time_t (except when required)
The C/C++ standards don't define what time_t is, only that it is
arithmetic (and real for C11, and integral for C++). It should not be
used in portable software and is only used as the return value for some
libc calls.
A common definition for time_t is int64_t, so we'll switch to that
permanently in our own APIs. System APIs will of course stick with
time_t.
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/types/metadata.h | 8 | ||||
-rw-r--r-- | host/include/uhd/types/time_spec.hpp | 12 | ||||
-rw-r--r-- | host/include/uhd/usrp/usrp.h | 14 |
3 files changed, 18 insertions, 16 deletions
diff --git a/host/include/uhd/types/metadata.h b/host/include/uhd/types/metadata.h index a711731d4..623adb77f 100644 --- a/host/include/uhd/types/metadata.h +++ b/host/include/uhd/types/metadata.h @@ -113,7 +113,7 @@ UHD_API uhd_error uhd_rx_metadata_has_time_spec( //! Time of first sample UHD_API uhd_error uhd_rx_metadata_time_spec( uhd_rx_metadata_handle h, - time_t *full_secs_out, + int64_t *full_secs_out, double *frac_secs_out ); @@ -212,7 +212,7 @@ UHD_API uhd_error uhd_rx_metadata_last_error( UHD_API uhd_error uhd_tx_metadata_make( uhd_tx_metadata_handle* handle, bool has_time_spec, - time_t full_secs, + int64_t full_secs, double frac_secs, bool start_of_burst, bool end_of_burst @@ -236,7 +236,7 @@ UHD_API uhd_error uhd_tx_metadata_has_time_spec( //! Get time specification UHD_API uhd_error uhd_tx_metadata_time_spec( uhd_tx_metadata_handle h, - time_t *full_secs_out, + int64_t *full_secs_out, double *frac_secs_out ); @@ -316,7 +316,7 @@ UHD_API uhd_error uhd_async_metadata_has_time_spec( //! Get time specification UHD_API uhd_error uhd_async_metadata_time_spec( uhd_async_metadata_handle h, - time_t *full_secs_out, + int64_t *full_secs_out, double *frac_secs_out ); diff --git a/host/include/uhd/types/time_spec.hpp b/host/include/uhd/types/time_spec.hpp index 32810c6e9..54fd9d379 100644 --- a/host/include/uhd/types/time_spec.hpp +++ b/host/include/uhd/types/time_spec.hpp @@ -40,7 +40,7 @@ namespace uhd{ * \param full_secs the whole/integer seconds count * \param frac_secs the fractional seconds count (default = 0) */ - time_spec_t(time_t full_secs, double frac_secs = 0); + time_spec_t(int64_t full_secs, double frac_secs = 0); /*! * Create a time_spec_t from whole seconds and fractional ticks. @@ -49,7 +49,7 @@ namespace uhd{ * \param tick_count the fractional seconds tick count * \param tick_rate the number of ticks per second */ - time_spec_t(time_t full_secs, long tick_count, double tick_rate); + time_spec_t(int64_t full_secs, long tick_count, double tick_rate); /*! * Create a time_spec_t from a 64-bit tick count. @@ -87,7 +87,7 @@ namespace uhd{ * Get the whole/integer part of the time in seconds. * \return the whole/integer seconds */ - time_t get_full_secs(void) const; + int64_t get_full_secs(void) const; /*! * Get the fractional part of the time in seconds. @@ -104,7 +104,9 @@ namespace uhd{ time_spec_t &operator-=(const time_spec_t &); //private time storage details - private: time_t _full_secs; double _frac_secs; + private: + int64_t _full_secs; + double _frac_secs; }; //! Implement equality_comparable interface @@ -113,7 +115,7 @@ namespace uhd{ //! Implement less_than_comparable interface UHD_API bool operator<(const time_spec_t &, const time_spec_t &); - UHD_INLINE time_t time_spec_t::get_full_secs(void) const{ + UHD_INLINE int64_t time_spec_t::get_full_secs(void) const{ return this->_full_secs; } diff --git a/host/include/uhd/usrp/usrp.h b/host/include/uhd/usrp/usrp.h index f8f81cc31..0ede389ef 100644 --- a/host/include/uhd/usrp/usrp.h +++ b/host/include/uhd/usrp/usrp.h @@ -83,7 +83,7 @@ typedef struct { //! Stream now? bool stream_now; //! If not now, then full seconds into future to stream - time_t time_spec_full_secs; + int64_t time_spec_full_secs; //! If not now, then fractional seconds into future to stream double time_spec_frac_secs; } uhd_stream_cmd_t; @@ -416,7 +416,7 @@ UHD_API uhd_error uhd_usrp_get_mboard_name( UHD_API uhd_error uhd_usrp_get_time_now( uhd_usrp_handle h, size_t mboard, - time_t *full_secs_out, + int64_t *full_secs_out, double *frac_secs_out ); @@ -427,7 +427,7 @@ UHD_API uhd_error uhd_usrp_get_time_now( UHD_API uhd_error uhd_usrp_get_time_last_pps( uhd_usrp_handle h, size_t mboard, - time_t *full_secs_out, + int64_t *full_secs_out, double *frac_secs_out ); @@ -437,7 +437,7 @@ UHD_API uhd_error uhd_usrp_get_time_last_pps( */ UHD_API uhd_error uhd_usrp_set_time_now( uhd_usrp_handle h, - time_t full_secs, + int64_t full_secs, double frac_secs, size_t mboard ); @@ -448,7 +448,7 @@ UHD_API uhd_error uhd_usrp_set_time_now( */ UHD_API uhd_error uhd_usrp_set_time_next_pps( uhd_usrp_handle h, - time_t full_secs, + int64_t full_secs, double frac_secs, size_t mboard ); @@ -459,7 +459,7 @@ UHD_API uhd_error uhd_usrp_set_time_next_pps( */ UHD_API uhd_error uhd_usrp_set_time_unknown_pps( uhd_usrp_handle h, - time_t full_secs, + int64_t full_secs, double frac_secs ); @@ -475,7 +475,7 @@ UHD_API uhd_error uhd_usrp_get_time_synchronized( */ UHD_API uhd_error uhd_usrp_set_command_time( uhd_usrp_handle h, - time_t full_secs, + int64_t full_secs, double frac_secs, size_t mboard ); |