stats: use GTimer instead of time(NULL)

time(NULL) shows the wrong results when the machine's clock is
changed.
This commit is contained in:
Max Kellermann
2009-01-18 15:40:53 +01:00
parent 14ca99b224
commit 004dfddca3
3 changed files with 13 additions and 3 deletions

View File

@@ -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());