chiark / gitweb /
logind: use deserialize_timestamp_value()
authorAlexander Kuleshov <kuleshovmail@gmail.com>
Mon, 15 Feb 2016 18:04:49 +0000 (00:04 +0600)
committerSven Eden <yamakuzure@gmx.net>
Fri, 16 Jun 2017 08:12:57 +0000 (10:12 +0200)
which is introduced in the ebf30a086d commit.

src/login/logind-session.c
src/login/logind-user.c

index c37e87565921dd634fb175cdaafe644e045f53e8..accf83d5f110d341008696476e2be8d87732dcfa 100644 (file)
@@ -452,17 +452,8 @@ int session_load(Session *s) {
                 safe_close(fd);
         }
 
-        if (realtime) {
-                unsigned long long l;
-                if (sscanf(realtime, "%llu", &l) > 0)
-                        s->timestamp.realtime = l;
-        }
-
-        if (monotonic) {
-                unsigned long long l;
-                if (sscanf(monotonic, "%llu", &l) > 0)
-                        s->timestamp.monotonic = l;
-        }
+        deserialize_timestamp_value(realtime, &s->timestamp.realtime);
+        deserialize_timestamp_value(monotonic, &s->timestamp.monotonic);
 
         if (controller) {
                 if (bus_name_has_owner(s->manager->bus, controller, NULL) > 0)
index b6daf65296920c8285e903ddd2506002f988c828..1814a0e8f52290036739868c19b80365e1ee6a14 100644 (file)
@@ -326,17 +326,8 @@ int user_load(User *u) {
         if (s && s->display && display_is_local(s->display))
                 u->display = s;
 
-        if (realtime) {
-                unsigned long long l;
-                if (sscanf(realtime, "%llu", &l) > 0)
-                        u->timestamp.realtime = l;
-        }
-
-        if (monotonic) {
-                unsigned long long l;
-                if (sscanf(monotonic, "%llu", &l) > 0)
-                        u->timestamp.monotonic = l;
-        }
+        deserialize_timestamp_value(realtime, &u->timestamp.realtime);
+        deserialize_timestamp_value(monotonic, &u->timestamp.monotonic);
 
         return r;
 }