From 8685d8eb47684da10a99f6a66547aa416ca0d7b8 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 9 Aug 2013 15:40:46 -0400 Subject: remove use of jack_get_time() from ARDOUR::get_microseconds(), use clock_gettime() instead since this function is never used in reference to a backend clock --- libs/ardour/ardour/ardour.h | 4 +--- libs/ardour/globals.cc | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'libs/ardour') diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index 5f64c4b6a3..73413c4cc2 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -67,9 +67,7 @@ namespace ARDOUR { bool translations_are_enabled (); bool set_translations_enabled (bool); - static inline microseconds_t get_microseconds () { - return (microseconds_t) jack_get_time(); - } + microseconds_t get_microseconds (); void setup_fpu (); std::vector get_available_sync_options(); diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index fbce336283..89edc66e84 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef WINDOWS_VST_SUPPORT #include @@ -535,3 +536,18 @@ ARDOUR::get_available_sync_options () return ret; } + +/** Return a monotonic value for the number of microseconds that have elapsed + * since an arbitrary zero origin. + */ + +microseconds_t +ARDOUR::get_microseconds () +{ + struct timespec ts; + if (clock_gettime (CLOCK_MONOTONIC, &ts) != 0) { + /* EEEK! */ + return 0; + } + return (microseconds_t) ts.tv_sec * 1000000 + (ts.tv_nsec/1000); +} -- cgit v1.2.3