Time, Mr. Freeman?

This commit is contained in:
2023-11-17 12:27:18 -06:00
parent d619231357
commit 89139853ee
10 changed files with 105 additions and 3 deletions

View File

@ -25,4 +25,4 @@ target_include_directories(${DAWN_TARGET_NAME}
# Subdirs
add_subdirectory(display)
add_subdirectory(input)
# add_subdirectory(time)
add_subdirectory(time)

View File

@ -0,0 +1,9 @@
# Copyright (c) 2022 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
target_sources(${DAWN_TARGET_NAME}
PRIVATE
TimeManager.cpp
)

View File

@ -0,0 +1,17 @@
// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "TimeManager.hpp"
#include <sys/time.h>
#include <chrono>
#include <ctime>
#include <iostream>
using namespace Dawn;
int64_t TimeManager::getRealTime() {
auto millisec_since_epoch = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()) .count();
return millisec_since_epoch;
}

View File

@ -0,0 +1,14 @@
// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "time/ITimeManager.hpp"
namespace Dawn {
class TimeManager : public ITimeManager {
public:
int64_t getRealTime() override;
};
}