aboutsummaryrefslogtreecommitdiff
path: root/libbutl/timestamp.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-05-16 17:44:28 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-05-16 17:44:28 +0300
commitcf9d0332f6b4dcd7dc388133ffd8fd6edd07e1c1 (patch)
tree109d6ec69c93920d2db08f7ec072ba8de270a032 /libbutl/timestamp.cxx
parented3f024f40771c90e0eb7ef5a51e7e01ab0247d4 (diff)
Add to_string(timestamp)
Diffstat (limited to 'libbutl/timestamp.cxx')
-rw-r--r--libbutl/timestamp.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/libbutl/timestamp.cxx b/libbutl/timestamp.cxx
index 1f12f41..cf84dd5 100644
--- a/libbutl/timestamp.cxx
+++ b/libbutl/timestamp.cxx
@@ -10,6 +10,7 @@
#include <ctime> // tm, time_t, mktime()
#include <cstdlib> // strtoull()
#include <cassert>
+#include <sstream>
#include <iomanip> // put_time(), setw(), dec, right
#include <cstring> // strlen(), memcpy()
#include <ostream>
@@ -219,6 +220,17 @@ namespace butl
return os;
}
+ string
+ to_string (const timestamp& ts,
+ const char* format,
+ bool special,
+ bool local)
+ {
+ ostringstream o;
+ to_stream (o, ts, format, special, local);
+ return o.str ();
+ }
+
ostream&
operator<< (ostream& os, const duration& d)
{
@@ -338,7 +350,6 @@ extern "C"
#include <ctime> // tm
#include <locale>
#include <clocale>
-#include <sstream>
#include <iomanip>
#include <cstring> // strlen()