diff options
author | José Bollo <jose.bollo@iot.bzh> | 2018-04-25 16:48:58 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2018-06-13 17:14:48 +0200 |
commit | 95ee37b3cdb38efc4e77d072d00c7fc46b203d24 (patch) | |
tree | 7b54b043539c1e87b09d6aac14b66227fa2941da | |
parent | 65e9c2b1fe1ea900383307ba7413ca379acbce4d (diff) |
afb-hook: Refactor timestamps of hooks and trace
Change-Id: Iebcab280123d1f954eda3b1260d0b984ae3a98b5
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | src/afb-hook.c | 2 | ||||
-rw-r--r-- | src/afb-trace.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/afb-hook.c b/src/afb-hook.c index a3748342..83ffb5f8 100644 --- a/src/afb-hook.c +++ b/src/afb-hook.c @@ -144,7 +144,7 @@ static unsigned next_hookid = 0; static void init_hookid(struct afb_hookid *hookid) { hookid->id = __atomic_add_fetch(&next_hookid, 1, __ATOMIC_RELAXED); - clock_gettime(CLOCK_MONOTONIC, &hookid->time); + clock_gettime(CLOCK_REALTIME, &hookid->time); } /****************************************************************************** diff --git a/src/afb-trace.c b/src/afb-trace.c index 5404a5af..f5f9c19e 100644 --- a/src/afb-trace.c +++ b/src/afb-trace.c @@ -168,7 +168,7 @@ static struct json_object *timestamp(const struct afb_hookid *hookid) { char ts[50]; - snprintf(ts, sizeof ts, "%llu.%06lu", (long long unsigned)hookid->time.tv_sec, (long unsigned)(hookid->time.tv_nsec / 1000)); + snprintf(ts, sizeof ts, "%llu.%09llu", (long long unsigned)hookid->time.tv_sec, (long long unsigned)hookid->time.tv_nsec); return json_object_new_string(ts); } |