summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-10-27 00:01:12 +0200
committerLennart Poettering <lennart@poettering.net>2010-10-27 00:01:12 +0200
commit10717a1a8d48e50463abf2f6b47e2618eaa529e7 (patch)
treed4750ea20c9b185eab67ef8f9282f4bb2229449f /src/util.c
parent248e6030e007b6ee7b31ada6e42053cb1ebfc80d (diff)
unit: serialize active timestamps
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index f5ee29897f..d653d6b549 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3528,6 +3528,36 @@ finish:
return r;
}
+void dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t) {
+
+ assert(f);
+ assert(name);
+ assert(t);
+
+ if (!dual_timestamp_is_set(t))
+ return;
+
+ fprintf(f, "%s=%llu %llu\n",
+ name,
+ (unsigned long long) t->realtime,
+ (unsigned long long) t->monotonic);
+}
+
+void dual_timestamp_deserialize(FILE *f, const char *value, dual_timestamp *t) {
+ unsigned long long a, b;
+
+ assert(f);
+ assert(value);
+ assert(t);
+
+ if (sscanf(value, "%lli %llu", &a, &b) != 2)
+ log_debug("Failed to parse finish timestamp value %s", value);
+ else {
+ t->realtime = a;
+ t->monotonic = b;
+ }
+}
+
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
[IOPRIO_CLASS_RT] = "realtime",