From 78c91e9e5b63adb191ab537fcc811602f90516a5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 8 Jan 2017 10:22:25 +0100 Subject: [PATCH] test/run_storage: don't print unknown time stamps --- test/run_storage.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/run_storage.cxx b/test/run_storage.cxx index 99992c3b8..805211fe0 100644 --- a/test/run_storage.cxx +++ b/test/run_storage.cxx @@ -67,8 +67,13 @@ Ls(Storage &storage, const char *path) break; } - char mtime[32]; - strftime(mtime, sizeof(mtime), "%F", gmtime(&info.mtime)); + char mtime_buffer[32]; + const char *mtime = " "; + if (info.mtime > 0) { + strftime(mtime_buffer, sizeof(mtime_buffer), "%F", + gmtime(&info.mtime)); + mtime = mtime_buffer; + } printf("%s %10llu %s %s\n", type, (unsigned long long)info.size,