Add Time helper class

This commit is contained in:
Karl 2021-04-30 10:23:14 +02:00
parent 1bb02f8e18
commit eea3560b35
3 changed files with 25 additions and 0 deletions

14
cpp/Time.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "Gedeng/Time.h"
#include <chrono>
namespace Gedeng {
unsigned long Time::get_time_ms() {
auto now = std::chrono::high_resolution_clock::now();
auto now_ms = std::chrono::time_point_cast<std::chrono::milliseconds>(now);
return now_ms.time_since_epoch().count();
}
}

View File

@ -4,5 +4,6 @@
#include "Gedeng/Logger.h"
#include "Gedeng/String.h"
#include "Gedeng/Vector.h"
#include "Gedeng/Time.h"
#include "Gedeng/EntryPoint.h"

10
include/Gedeng/Time.h Normal file
View File

@ -0,0 +1,10 @@
#pragma once
namespace Gedeng {
class Time {
public:
static unsigned long get_time_ms();
};
} // namespace Gedeng