Crypto backtesting
Loading...
Searching...
No Matches
time.cxx
Go to the documentation of this file.
1#include <ctime>
2#include <iomanip>
3#include <sstream>
4#include <string>
5
6/// Routine to convert epoch seconds to a UTC time string
7std::string epoch_to_utc(const size_t epoch) {
8 std::time_t t = epoch;
9 std::tm tm = *std::gmtime(&t);
10 std::ostringstream oss;
11 oss << std::put_time(&tm, "%Y-%m-%d %H:%M:%S");
12 return oss.str();
13}
std::string epoch_to_utc(const size_t epoch)
Routine to convert epoch seconds to a UTC time string.
Definition time.cxx:7