summaryrefslogtreecommitdiff
path: root/libs/surfaces/tranzport
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-05-16 19:58:46 +0200
committerRobin Gareus <robin@gareus.org>2014-05-16 19:58:46 +0200
commitf3349a797c98cb86f5106addf431543968241bc3 (patch)
tree6f19775c4b0e3e3bd3cf50db8c3ee75e8843c890 /libs/surfaces/tranzport
parent5fba8a2015706becc7e684fa7228de3e95f03515 (diff)
more gettimeofday() -> g_get_monotonic_time()
Diffstat (limited to 'libs/surfaces/tranzport')
-rw-r--r--libs/surfaces/tranzport/wheel.cc18
1 files changed, 7 insertions, 11 deletions
diff --git a/libs/surfaces/tranzport/wheel.cc b/libs/surfaces/tranzport/wheel.cc
index baa4ba079b..3f15e060a2 100644
--- a/libs/surfaces/tranzport/wheel.cc
+++ b/libs/surfaces/tranzport/wheel.cc
@@ -62,7 +62,7 @@ TranzportControlProtocol::datawheel ()
prev_track ();
}
- timerclear (&last_wheel_motion);
+ last_wheel_motion = 0;
} else if ((buttonmask & ButtonPrev) || (buttonmask & ButtonNext)) {
@@ -72,7 +72,7 @@ TranzportControlProtocol::datawheel ()
prev_marker ();
}
- timerclear (&last_wheel_motion);
+ last_wheel_motion = 0;
} else if (buttonmask & ButtonShift) {
@@ -104,7 +104,7 @@ TranzportControlProtocol::datawheel ()
}
}
- timerclear (&last_wheel_motion);
+ last_wheel_motion = 0;
} else {
@@ -149,11 +149,10 @@ void
TranzportControlProtocol::scrub ()
{
float speed;
- struct timeval now;
- struct timeval delta;
+ uint64_t now;
int dir;
- gettimeofday (&now, 0);
+ now = g_get_monotonic_time();
if (_datawheel < WheelDirectionThreshold) {
dir = 1;
@@ -165,13 +164,10 @@ TranzportControlProtocol::scrub ()
/* changed direction, start over */
speed = 0.1f;
} else {
- if (timerisset (&last_wheel_motion)) {
-
- timersub (&now, &last_wheel_motion, &delta);
-
+ if (last_wheel_motion != 0) {
/* 10 clicks per second => speed == 1.0 */
- speed = 100000.0f / (delta.tv_sec * 1000000 + delta.tv_usec);
+ speed = 100000.0f / (float) (now - last_wheel_motion)
} else {