summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-07 03:53:12 +0000
committerDavid Robillard <d@drobilla.net>2011-12-07 03:53:12 +0000
commitf6eea7bc7aaca5afea1f8cc8c80ccd5fbccc2deb (patch)
tree83d16f2c215eac48401970fc8c3ded2a7449cfc2
parent9ce9a936d4150e51b77bf1ab89263afbcc729a7e (diff)
downloadganv-f6eea7bc7aaca5afea1f8cc8c80ccd5fbccc2deb.tar.gz
ganv-f6eea7bc7aaca5afea1f8cc8c80ccd5fbccc2deb.tar.bz2
ganv-f6eea7bc7aaca5afea1f8cc8c80ccd5fbccc2deb.zip
Support old glib without g_get_monotonic_time (fix #791).
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@3827 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/Canvas.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 841c3cf..ca50e3f 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -1219,7 +1219,14 @@ GanvCanvasImpl::ports_joined(GanvPort* port1, GanvPort* port2)
bool
GanvCanvasImpl::animate_selected()
{
+#ifdef g_get_monotonic_time
+ // Only available in glib 2.28
const double seconds = g_get_monotonic_time() / 1000000.0;
+#else
+ GTimeVal time;
+ g_get_current_time(&time);
+ const double seconds = time.tv_sec + time.tv_usec / (double)G_USEC_PER_SEC;
+#endif
FOREACH_ITEM(_selected_items, s) {
ganv_node_tick(*s, seconds);