interface/os: sleep_us()

This commit is contained in:
Perttu Ahola 2014-10-28 01:49:39 +02:00
parent 470d77cb68
commit c2877aaca2
2 changed files with 11 additions and 0 deletions

View File

@ -2,6 +2,11 @@
// Copyright 2014 Perttu Ahola <celeron55@gmail.com>
#include "interface/os.h"
#include <sys/time.h>
#ifdef _WIN32
#include "ports/windows_compat.h"
#else
#include <unistd.h>
#endif
namespace interface {
namespace os {
@ -13,6 +18,11 @@ int64_t get_timeofday_us()
return (int64_t)tv.tv_sec * 1000000 + (int64_t)tv.tv_usec;
}
void sleep_us(int us)
{
usleep(us);
}
}
}
// vim: set noet ts=4 sw=4:

View File

@ -8,6 +8,7 @@ namespace interface
namespace os
{
int64_t get_timeofday_us();
void sleep_us(int us);
}
}