Files
NazaraEngine/src/Nazara/Core/Posix/TimeImpl.cpp
2023-01-22 17:41:18 +01:00

32 lines
749 B
C++

// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/Posix/TimeImpl.hpp>
#include <time.h>
#include <Nazara/Core/Debug.hpp>
namespace Nz
{
bool InitializeHighPrecisionTimer()
{
return true; //< No initialization required
}
Time GetElapsedNanosecondsImpl()
{
timespec time;
clock_gettime(CLOCK_MONOTONIC, &time);
return Time::Seconds(time.tv_sec) + Time::Nanoseconds(time.tv_nsec);
}
Time GetElapsedMillisecondsImpl()
{
timespec time;
clock_gettime(CLOCK_MONOTONIC, &time);
return Time::Seconds(time.tv_sec) + Time::Nanoseconds(time.tv_nsec);
}
}