diff options
author | Bastien Nocera <hadess@hadess.net> | 2014-09-24 15:15:23 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2014-09-24 15:16:11 +0200 |
commit | 5ddfe0dba19c069b16a1b38cac2fa9dc8372862d (patch) | |
tree | 1d806f20386cf172e86fef0140868e480b0333f5 /src/openbsd | |
parent | 8271045a68b5d34a47d0c6214681e2b088234d2e (diff) | |
download | upower-5ddfe0dba19c069b16a1b38cac2fa9dc8372862d.tar.gz |
all: Use g_get_real_time() when possible
Instead of a call to g_get_current_time().
Diffstat (limited to 'src/openbsd')
-rw-r--r-- | src/openbsd/up-backend.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/openbsd/up-backend.c b/src/openbsd/up-backend.c index d40a269..1258770 100644 --- a/src/openbsd/up-backend.c +++ b/src/openbsd/up-backend.c @@ -399,7 +399,6 @@ static gboolean up_apm_device_refresh(UpDevice* device) { UpDeviceKind type; - GTimeVal timeval; gboolean ret; g_object_get (device, "type", &type, NULL); @@ -415,10 +414,8 @@ up_apm_device_refresh(UpDevice* device) break; } - if (ret) { - g_get_current_time (&timeval); - g_object_set (device, "update-time", (guint64) timeval.tv_sec, NULL); - } + if (ret) + g_object_set (device, "update-time", (guint64) g_get_real_time (), NULL); return ret; } @@ -578,8 +575,8 @@ static void up_backend_init (UpBackend *backend) { GError *err = NULL; - GTimeVal timeval; UpDeviceClass *device_class; + gint64 current_time; backend->priv = UP_BACKEND_GET_PRIVATE (backend); backend->priv->is_laptop = up_native_is_laptop(); @@ -604,7 +601,7 @@ up_backend_init (UpBackend *backend) } /* setup dummy */ - g_get_current_time (&timeval); + current_time = g_get_real_time (); g_object_set (backend->priv->battery, "type", UP_DEVICE_KIND_BATTERY, "power-supply", TRUE, @@ -614,13 +611,13 @@ up_backend_init (UpBackend *backend) "state", UP_DEVICE_STATE_UNKNOWN, "percentage", 0.0f, "time-to-empty", (gint64) 0, - "update-time", (guint64) timeval.tv_sec, + "update-time", (guint64) current_time, (void*) NULL); g_object_set (backend->priv->ac, "type", UP_DEVICE_KIND_LINE_POWER, "online", TRUE, "power-supply", TRUE, - "update-time", (guint64) timeval.tv_sec, + "update-time", (guint64) current_time, (void*) NULL); } } |