interface/os
This commit is contained in:
parent
813bfe79a3
commit
a71a4c56ef
@ -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
17
src/impl/os.cpp
Normal 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
14
src/interface/os.h
Normal 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:
|
Loading…
x
Reference in New Issue
Block a user