summaryrefslogtreecommitdiff
path: root/louloulibs/utils/time.cpp
blob: e23def4b8fc0a2e6ad3f9399609c8d590b5e27ad (plain)
1
2
3
4
5
6
7
8
9
10
11
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)};
}
}