interface/os

This commit is contained in:
Perttu Ahola 2014-10-20 17:15:28 +03:00
parent 813bfe79a3
commit a71a4c56ef
3 changed files with 32 additions and 0 deletions

View File

@ -123,6 +123,7 @@ set(BUILDAT_CORE_SRCS
src/impl/voxel_volume.cpp
src/impl/compress.cpp
src/impl/worker_thread.cpp
src/impl/os.cpp
)
if(WIN32)
set(BUILDAT_CORE_SRCS ${BUILDAT_CORE_SRCS} src/impl/windows/file_watch.cpp)

17
src/impl/os.cpp Normal file
View File

@ -0,0 +1,17 @@
// http://www.apache.org/licenses/LICENSE-2.0
// Copyright 2014 Perttu Ahola <celeron55@gmail.com>
#include "interface/os.h"
#include <sys/time.h>
namespace interface {
namespace os {
int64_t get_timeofday_us()
{
struct timeval tv;
gettimeofday(&tv, nullptr);
return (int64_t)tv.tv_sec * 1000000 + (int64_t)tv.tv_usec;
}
}}
// vim: set noet ts=4 sw=4:

14
src/interface/os.h Normal file
View File

@ -0,0 +1,14 @@
// http://www.apache.org/licenses/LICENSE-2.0
// Copyright 2014 Perttu Ahola <celeron55@gmail.com>
#pragma once
#include "core/types.h"
namespace interface
{
namespace os
{
int64_t get_timeofday_us();
}
}
// vim: set noet ts=4 sw=4: