aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/types
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-08-24 15:48:42 -0700
committerMartin Braun <martin.braun@ettus.com>2018-03-05 13:53:45 -0800
commit7fa1f6ed0726ff0f908245e43a01f50620293e8d (patch)
tree714036231990d38fc4ccd2b2913b6a4ebac2235d /host/lib/types
parent347bb79d2adef4b5bf3e3a94577ecc18c0408519 (diff)
downloaduhd-7fa1f6ed0726ff0f908245e43a01f50620293e8d.tar.gz
uhd-7fa1f6ed0726ff0f908245e43a01f50620293e8d.tar.bz2
uhd-7fa1f6ed0726ff0f908245e43a01f50620293e8d.zip
uhd: Moved get_system_time outside of public API
uhd::get_system_time() is an abstracted way of reading back a time, and is not UHD-specific. As such, there's no reason to keep it in the public part of the API where we're contractually obligated not to touch it. Instead, moving it to the internal API space.
Diffstat (limited to 'host/lib/types')
-rw-r--r--host/lib/types/CMakeLists.txt61
-rw-r--r--host/lib/types/time_spec.cpp48
2 files changed, 0 insertions, 109 deletions
diff --git a/host/lib/types/CMakeLists.txt b/host/lib/types/CMakeLists.txt
index 2156160cd..7f8c80c95 100644
--- a/host/lib/types/CMakeLists.txt
+++ b/host/lib/types/CMakeLists.txt
@@ -6,67 +6,6 @@
#
########################################################################
-# Setup defines for high resolution timing
-########################################################################
-MESSAGE(STATUS "")
-MESSAGE(STATUS "Configuring high resolution timing...")
-INCLUDE(CheckCXXSourceCompiles)
-
-SET(CMAKE_REQUIRED_LIBRARIES -lrt)
-CHECK_CXX_SOURCE_COMPILES("
- #include <ctime>
- int main(){
- timespec ts;
- return clock_gettime(CLOCK_MONOTONIC, &ts);
- }
- " HAVE_CLOCK_GETTIME
-)
-SET(CMAKE_REQUIRED_LIBRARIES)
-
-INCLUDE(CheckCXXSourceCompiles)
-CHECK_CXX_SOURCE_COMPILES("
- #include <mach/mach_time.h>
- int main(){
- mach_timebase_info_data_t info;
- mach_timebase_info(&info);
- mach_absolute_time();
- return 0;
- }
- " HAVE_MACH_ABSOLUTE_TIME
-)
-
-CHECK_CXX_SOURCE_COMPILES("
- #include <Windows.h>
- int main(){
- LARGE_INTEGER value;
- QueryPerformanceCounter(&value);
- QueryPerformanceFrequency(&value);
- return 0;
- }
- " HAVE_QUERY_PERFORMANCE_COUNTER
-)
-
-IF(HAVE_CLOCK_GETTIME)
- MESSAGE(STATUS " High resolution timing supported through clock_gettime.")
- SET(TIME_SPEC_DEFS HAVE_CLOCK_GETTIME)
- LIBUHD_APPEND_LIBS("-lrt")
-ELSEIF(HAVE_MACH_ABSOLUTE_TIME)
- MESSAGE(STATUS " High resolution timing supported through mach_absolute_time.")
- SET(TIME_SPEC_DEFS HAVE_MACH_ABSOLUTE_TIME)
-ELSEIF(HAVE_QUERY_PERFORMANCE_COUNTER)
- MESSAGE(STATUS " High resolution timing supported through QueryPerformanceCounter.")
- SET(TIME_SPEC_DEFS HAVE_QUERY_PERFORMANCE_COUNTER)
-ELSE()
- MESSAGE(STATUS " High resolution timing supported though microsec_clock.")
- SET(TIME_SPEC_DEFS HAVE_MICROSEC_CLOCK)
-ENDIF()
-
-SET_SOURCE_FILES_PROPERTIES(
- ${CMAKE_CURRENT_SOURCE_DIR}/time_spec.cpp
- PROPERTIES COMPILE_DEFINITIONS "${TIME_SPEC_DEFS}"
-)
-
-########################################################################
# This file included, use CMake directory variables
########################################################################
LIBUHD_APPEND_SOURCES(
diff --git a/host/lib/types/time_spec.cpp b/host/lib/types/time_spec.cpp
index 40df87611..aae6a6121 100644
--- a/host/lib/types/time_spec.cpp
+++ b/host/lib/types/time_spec.cpp
@@ -10,54 +10,6 @@
using namespace uhd;
/***********************************************************************
- * Time spec system time
- **********************************************************************/
-
-#ifdef HAVE_CLOCK_GETTIME
-#include <time.h>
-time_spec_t time_spec_t::get_system_time(void){
- timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts);
- return time_spec_t(ts.tv_sec, ts.tv_nsec, 1e9);
-}
-#endif /* HAVE_CLOCK_GETTIME */
-
-
-#ifdef HAVE_MACH_ABSOLUTE_TIME
-#include <mach/mach_time.h>
-time_spec_t time_spec_t::get_system_time(void){
- mach_timebase_info_data_t info; mach_timebase_info(&info);
- intmax_t nanosecs = mach_absolute_time()*info.numer/info.denom;
- return time_spec_t::from_ticks(nanosecs, 1e9);
-}
-#endif /* HAVE_MACH_ABSOLUTE_TIME */
-
-
-#ifdef HAVE_QUERY_PERFORMANCE_COUNTER
-#include <Windows.h>
-time_spec_t time_spec_t::get_system_time(void){
- LARGE_INTEGER counts, freq;
- QueryPerformanceCounter(&counts);
- QueryPerformanceFrequency(&freq);
- return time_spec_t::from_ticks(counts.QuadPart, double(freq.QuadPart));
-}
-#endif /* HAVE_QUERY_PERFORMANCE_COUNTER */
-
-
-#ifdef HAVE_MICROSEC_CLOCK
-#include <boost/date_time/posix_time/posix_time.hpp>
-namespace pt = boost::posix_time;
-time_spec_t time_spec_t::get_system_time(void){
- pt::ptime time_now = pt::microsec_clock::universal_time();
- pt::time_duration time_dur = time_now - pt::from_time_t(0);
- return time_spec_t(
- time_t(time_dur.total_seconds()),
- long(time_dur.fractional_seconds()),
- double(pt::time_duration::ticks_per_second())
- );
-}
-#endif /* HAVE_MICROSEC_CLOCK */
-
-/***********************************************************************
* Time spec constructors
**********************************************************************/
#define time_spec_init(full, frac) { \