19 lines
428 B
C++
19 lines
428 B
C++
#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
|