diff options
Diffstat (limited to 'typing-break/drw-timer.c')
-rw-r--r-- | typing-break/drw-timer.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/typing-break/drw-timer.c b/typing-break/drw-timer.c index a757911e..fc7cc104 100644 --- a/typing-break/drw-timer.c +++ b/typing-break/drw-timer.c @@ -23,7 +23,7 @@ struct _DrwTimer { - GTimeVal start_time; + gint64 start_time; }; DrwTimer * drw_timer_new (void) @@ -35,14 +35,12 @@ DrwTimer * drw_timer_new (void) void drw_timer_start (DrwTimer *timer) { - g_get_current_time (&timer->start_time); + timer->start_time = g_get_real_time (); } -double drw_timer_elapsed (DrwTimer *timer) +gint drw_timer_elapsed (DrwTimer *timer) { - GTimeVal now; - g_get_current_time (&now); - return now.tv_sec - timer->start_time.tv_sec; + return (g_get_real_time () - timer->start_time) / G_USEC_PER_SEC; } void drw_timer_destroy (DrwTimer *timer) |