summaryrefslogtreecommitdiff
path: root/libs/ardour/globals.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-08-09 15:40:46 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-08-09 15:40:46 -0400
commit8685d8eb47684da10a99f6a66547aa416ca0d7b8 (patch)
treeeb616c9501e39e54526f018a408047a652613ea6 /libs/ardour/globals.cc
parentca76496ef377e826d356f9d29f6a57393c59298a (diff)
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
Diffstat (limited to 'libs/ardour/globals.cc')
-rw-r--r--libs/ardour/globals.cc16
1 files changed, 16 insertions, 0 deletions
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 <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#include <time.h>
#ifdef WINDOWS_VST_SUPPORT
#include <fst.h>
@@ -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);
+}