[Core] Added POSIX support (Experimental)
Thanks to Danman I don't think it actually compile although tried my best to correct code. Former-commit-id: c3366c2c924f7392f4d46824dafca63ecf7f1fea
This commit is contained in:
28
src/Nazara/Core/Posix/ClockImpl.cpp
Normal file
28
src/Nazara/Core/Posix/ClockImpl.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2012 Alexandre Janniaux
|
||||
// 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()
|
||||
{
|
||||
return true; // 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));
|
||||
}
|
||||
Reference in New Issue
Block a user