]> err.no Git - systemd/commitdiff
manager: serialize/deserialize finish timestamp
authorLennart Poettering <lennart@poettering.net>
Mon, 18 Oct 2010 20:39:06 +0000 (22:39 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 18 Oct 2010 20:39:06 +0000 (22:39 +0200)
src/manager.c

index f2ec2b72ada50e6608b84f25419bd46c90e58211..e4559ffcb85702bc949903059842d7fb70994131 100644 (file)
@@ -2489,6 +2489,11 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds) {
                 (unsigned long long) m->startup_timestamp.realtime,
                 (unsigned long long) m->startup_timestamp.monotonic);
 
+        if (dual_timestamp_is_set(&m->finish_timestamp))
+                fprintf(f, "finish-timestamp=%llu %llu\n\n",
+                        (unsigned long long) m->finish_timestamp.realtime,
+                        (unsigned long long) m->finish_timestamp.monotonic);
+
         HASHMAP_FOREACH_KEY(u, t, m->units, i) {
                 if (u->meta.id != t)
                         continue;
@@ -2547,6 +2552,15 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
                                 m->startup_timestamp.realtime = a;
                                 m->startup_timestamp.monotonic = b;
                         }
+                } else if (startswith(l, "finish-timestamp=")) {
+                        unsigned long long a, b;
+
+                        if (sscanf(l+18, "%lli %llu", &a, &b) != 2)
+                                log_debug("Failed to parse finish timestamp value %s", l+18);
+                        else {
+                                m->finish_timestamp.realtime = a;
+                                m->finish_timestamp.monotonic = b;
+                        }
                 } else
                         log_debug("Unknown serialization item '%s'", l);
         }