Add Posix clock support.
Former-commit-id: 1631e1028e94a88f7d19d7c217d83b8ae17936d7
This commit is contained in:
parent
50870b9a2d
commit
1d224d23f6
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
|
// 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/ClockImpl.hpp>
|
||||||
|
#include <Nazara/Core/Error.hpp>
|
||||||
|
#include <ctime>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <Nazara/Core/Debug.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
bool NzClockImplInitializeHighPrecision()
|
||||||
|
{
|
||||||
|
// No initialization needed
|
||||||
|
}
|
||||||
|
|
||||||
|
nzUInt64 NzClockImplGetMicroseconds()
|
||||||
|
{
|
||||||
|
timeval clock;
|
||||||
|
gettimeofday(&clock, nullptr);
|
||||||
|
return static_cast<nzUInt64>(clock.tv_sec*1000000 + (clock.tv_nsec/1000));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
nzUInt64 NzClockImplGetMilliseconds()
|
||||||
|
{
|
||||||
|
timeval clock;
|
||||||
|
gettimeofday(&clock, nullptr);
|
||||||
|
return static_cast<nzUInt64>(clock.tv_sec*1000 + (clock.tv_nsec/1000000));
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Copyright (C) 2012 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_CLOCKIMPL_POSIX_HPP
|
||||||
|
#define NAZARA_CLOCKIMPL_POSIX_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
|
||||||
|
bool NzClockImplInitializeHighPrecision();
|
||||||
|
nzUInt64 NzClockImplGetMicroseconds();
|
||||||
|
nzUInt64 NzClockImplGetMilliseconds();
|
||||||
|
|
||||||
|
#endif // NAZARA_CLOCKIMPL_POSIX_HPP
|
||||||
Loading…
Reference in New Issue