MPGC/include/Utils.h

19 lines
428 B
C
Raw Normal View History

2025-04-03 22:22:17 +00:00
#ifndef UTILS_H
#define UTILS_H
#include <chrono>
#include <string>
#include <sstream>
// Returns the current timestamp in milliseconds since the epoch.
inline std::string getCurrentTimestamp() {
using namespace std::chrono;
auto now = system_clock::now();
auto ms = duration_cast<milliseconds>(now.time_since_epoch()).count();
std::ostringstream oss;
oss << ms;
return oss.str();
}
#endif // UTILS_H