]> git.ipfire.org Git - thirdparty/kernel/stable.git/blobdiff - tools/perf/util/time-utils.c
Merge tag 'drm/tegra/for-5.1-rc5' of git://anongit.freedesktop.org/tegra/linux into...
[thirdparty/kernel/stable.git] / tools / perf / util / time-utils.c
index 0f53baec660e2494db6f3e506ddff91c05d89c36..20663a460df34d63d9d575ebea8a7e7681099bc7 100644 (file)
@@ -453,6 +453,14 @@ int timestamp__scnprintf_usec(u64 timestamp, char *buf, size_t sz)
        return scnprintf(buf, sz, "%"PRIu64".%06"PRIu64, sec, usec);
 }
 
+int timestamp__scnprintf_nsec(u64 timestamp, char *buf, size_t sz)
+{
+       u64 sec  = timestamp / NSEC_PER_SEC,
+           nsec = timestamp % NSEC_PER_SEC;
+
+       return scnprintf(buf, sz, "%" PRIu64 ".%09" PRIu64, sec, nsec);
+}
+
 int fetch_current_timestamp(char *buf, size_t sz)
 {
        struct timeval tv;