diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-06-14 20:35:56 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-06-14 20:35:56 +0300 |
commit | 784f2c18990b71090f267db31a328b81b231b0a6 (patch) | |
tree | 5c7e0b5ab10abe67a33791fe4a8324c4a65468b7 | |
parent | cf703f3e302312e1602fe46dc2c1e32dee786e6b (diff) |
Fix printing duration
-rw-r--r-- | libbutl/timestamp.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libbutl/timestamp.cxx b/libbutl/timestamp.cxx index aae4622..eb4b5ce 100644 --- a/libbutl/timestamp.cxx +++ b/libbutl/timestamp.cxx @@ -244,7 +244,7 @@ namespace butl time_t t (system_clock::to_time_t (ts)); const char* fmt (nullptr); - const char* unt ("nanoseconds"); + const char* unt; if (t >= 365 * 24 * 60 * 60) { fmt = "%Y-%m-%d %H:%M:%S"; @@ -275,6 +275,8 @@ namespace butl fmt = "%S"; unt = "seconds"; } + else + unt = ns ? "nanoseconds" : "seconds"; if (fmt != nullptr) { @@ -317,8 +319,6 @@ namespace butl } else os << nsec.count (); - - os << ' ' << unt; } else if (fmt == nullptr) os << '0'; @@ -326,6 +326,7 @@ namespace butl else if (fmt == nullptr) os << '0'; + os << ' ' << unt; return os; } |