Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
004dfddc
Commit
004dfddc
authored
Jan 18, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stats: use GTimer instead of time(NULL)
time(NULL) shows the wrong results when the machine's clock is changed.
parent
14ca99b2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
main.c
src/main.c
+1
-0
stats.c
src/stats.c
+7
-2
stats.h
src/stats.h
+5
-1
No files found.
src/main.c
View file @
004dfddc
...
...
@@ -350,6 +350,7 @@ int main(int argc, char *argv[])
songvec_deinit
();
dirvec_deinit
();
idle_deinit
();
stats_global_finish
();
close_log_files
();
return
EXIT_SUCCESS
;
...
...
src/stats.c
View file @
004dfddc
...
...
@@ -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
());
...
...
src/stats.h
View file @
004dfddc
...
...
@@ -19,10 +19,12 @@
#ifndef MPD_STATS_H
#define MPD_STATS_H
#include <glib.h>
struct
client
;
struct
stats
{
unsigned
long
start_time
;
GTimer
*
timer
;
/** number of song files in the music directory */
unsigned
song_count
;
...
...
@@ -42,6 +44,8 @@ extern struct stats stats;
void
stats_global_init
(
void
);
void
stats_global_finish
(
void
);
void
stats_update
(
void
);
int
stats_print
(
struct
client
*
client
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment