FOSSredder 0.5.0
Loading...
Searching...
No Matches
Time.cpp
Go to the documentation of this file.
1
5
6#include "Time.h"
7
8#include <chrono>
9#include <ctime>
10#include <iomanip>
11#include <sstream>
12
13namespace core::utils {
14
16{
17 using clock = std::chrono::system_clock;
18 const auto now = clock::now();
19 const auto nowTime = clock::to_time_t(now);
20
21 std::tm tm{};
22#if defined(_WIN32)
23 gmtime_s(&tm, &nowTime);
24#else
25 gmtime_r(&nowTime, &tm);
26#endif
27
28 std::ostringstream out;
29 out << std::put_time(&tm, "%Y-%m-%dT%H:%M:%SZ");
30 return out.str();
31}
32
33}
Declares private UTC timestamp helpers for core implementation code.
std::string currentTimestampUtc()
Returns the current UTC timestamp in ISO-8601 format.
Definition Time.cpp:15