summaryrefslogtreecommitdiff
path: root/louloulibs/utils/time.cpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-08-25 19:43:51 +0200
committerlouiz’ <louiz@louiz.org>2016-08-28 22:42:50 +0200
commit7536a1b3f38fbf093c1629b0db209754ada0c906 (patch)
tree6d5f8f9d8ba3aa7274b75cc733dabdd89f20f29d /louloulibs/utils/time.cpp
parentb59fc2a834dccb35f12dcfec624b6181e4e2fbe9 (diff)
downloadbiboumi-7536a1b3f38fbf093c1629b0db209754ada0c906.tar.gz
biboumi-7536a1b3f38fbf093c1629b0db209754ada0c906.tar.bz2
biboumi-7536a1b3f38fbf093c1629b0db209754ada0c906.tar.xz
biboumi-7536a1b3f38fbf093c1629b0db209754ada0c906.zip
Respond to MAM requests on a channel JID
At the moment, result-set-management is not implemented, the whole history (well, at most 1024 messages) is returned.
Diffstat (limited to 'louloulibs/utils/time.cpp')
-rw-r--r--louloulibs/utils/time.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/louloulibs/utils/time.cpp b/louloulibs/utils/time.cpp
new file mode 100644
index 0000000..e23def4
--- /dev/null
+++ b/louloulibs/utils/time.cpp
@@ -0,0 +1,12 @@
+#include <utils/time.hpp>
+
+namespace utils
+{
+std::string to_string(const std::time_t& timestamp)
+{
+ constexpr std::size_t stamp_size = 20;
+ char date_buf[stamp_size];
+ std::strftime(date_buf, stamp_size, "%FT%TZ", std::gmtime(&timestamp));
+ return {std::begin(date_buf), std::end(date_buf)};
+}
+} \ No newline at end of file