mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
mc_timer: use g_get_real_time() instead of gettimeofday().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
63aba8f7e2
commit
3143196247
12
lib/timer.c
12
lib/timer.c
@ -29,8 +29,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "lib/global.h"
|
||||
#include "lib/timer.h"
|
||||
|
||||
@ -69,11 +67,9 @@ mc_timer_t *
|
||||
mc_timer_new (void)
|
||||
{
|
||||
mc_timer_t *timer;
|
||||
struct timeval tv;
|
||||
|
||||
timer = g_new (mc_timer_t, 1);
|
||||
gettimeofday (&tv, NULL);
|
||||
timer->start = (guint64) tv.tv_sec * G_USEC_PER_SEC + (guint64) tv.tv_usec;
|
||||
timer->start = (guint64) g_get_real_time ();
|
||||
|
||||
return timer;
|
||||
}
|
||||
@ -104,11 +100,7 @@ mc_timer_destroy (mc_timer_t * timer)
|
||||
guint64
|
||||
mc_timer_elapsed (const mc_timer_t * timer)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday (&tv, NULL);
|
||||
|
||||
return ((guint64) tv.tv_sec * G_USEC_PER_SEC + (guint64) tv.tv_usec - timer->start);
|
||||
return ((guint64) g_get_real_time () - timer->start);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
Loading…
Reference in New Issue
Block a user