summaryrefslogtreecommitdiff
path: root/src/timer.c
diff options
context:
space:
mode:
authorRoger Bystrøm <roger@remiss.org>2007-06-09 14:03:09 +0000
committerRoger Bystrøm <roger@remiss.org>2007-06-09 14:03:09 +0000
commita8866004743fd6b997da81907f9527b405a5e498 (patch)
tree5672c68d9754765b6d89b1a0f190f8e3f53ea240 /src/timer.c
parent9ccf0d8a2555a73854cde6e2e4cee3bdb6421ec5 (diff)
Added timer_get_runtime_ms to know how long the timer has been running
git-svn-id: https://svn.musicpd.org/mpd/trunk@6521 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/timer.c')
-rw-r--r--src/timer.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/timer.c b/src/timer.c
index 0406a945e..f808fb02f 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -51,7 +51,7 @@ void timer_free(Timer *timer)
void timer_start(Timer *timer)
{
- timer->time = now();
+ timer->start_time = timer->time = now();
timer->started = 1;
}
@@ -59,6 +59,7 @@ void timer_reset(Timer *timer)
{
timer->time = 0;
timer->started = 0;
+ timer->start_time = 0;
}
void timer_add(Timer *timer, int size)
@@ -78,3 +79,8 @@ void timer_sync(Timer *timer)
if (sleep > 0)
my_usleep(sleep);
}
+
+int timer_get_runtime_ms(Timer *timer)
+{
+ return (now() - timer->start_time)/1000;
+}