aboutsummaryrefslogtreecommitdiff
path: root/libbutl/timestamp.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbutl/timestamp.hxx')
-rw-r--r--libbutl/timestamp.hxx18
1 files changed, 16 insertions, 2 deletions
diff --git a/libbutl/timestamp.hxx b/libbutl/timestamp.hxx
index 9fb0f59..8a5c71a 100644
--- a/libbutl/timestamp.hxx
+++ b/libbutl/timestamp.hxx
@@ -88,7 +88,7 @@ namespace butl
bool special,
bool local);
- // Same as above, but provide the result as string. Note that it is
+ // Same as above, but provide the result as a string. Note that it is
// implemented via to_stream() and std::ostringstream.
//
LIBBUTL_EXPORT std::string
@@ -103,8 +103,22 @@ namespace butl
return to_stream (os, ts, "%Y-%m-%d %H:%M:%S%[.N]", true, true);
}
+ // Print human-readable representation of the duration.
+ //
LIBBUTL_EXPORT std::ostream&
- operator<< (std::ostream&, const duration&);
+ to_stream (std::ostream&, const duration&, bool nanoseconds);
+
+ // Same as above, but provide the result as a string. Note that it is
+ // implemented via to_stream() and std::ostringstream.
+ //
+ LIBBUTL_EXPORT std::string
+ to_string (const duration&, bool nanoseconds);
+
+ inline std::ostream&
+ operator<< (std::ostream& os, const duration& d)
+ {
+ return to_stream (os, d, true);
+ }
// Parse human-readable representation of the timestamp.
//