From 004dfddca383394426f6d191a43c9a0131cdee34 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 18 Jan 2009 15:40:53 +0100 Subject: stats: use GTimer instead of time(NULL) time(NULL) shows the wrong results when the machine's clock is changed. --- src/stats.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/stats.c') diff --git a/src/stats.c b/src/stats.c index c85c705d7..937ca3e3f 100644 --- a/src/stats.c +++ b/src/stats.c @@ -29,7 +29,12 @@ struct stats stats; void stats_global_init(void) { - stats.start_time = time(NULL); + stats.timer = g_timer_new(); +} + +void stats_global_finish(void) +{ + g_timer_destroy(stats.timer); } struct visit_data { @@ -107,7 +112,7 @@ int stats_print(struct client *client) stats.artist_count, stats.album_count, stats.song_count, - time(NULL) - stats.start_time, + (long)g_timer_elapsed(stats.timer, NULL), (long)(getPlayerTotalPlayTime() + 0.5), stats.song_duration, db_get_mtime()); -- cgit v1.2.3