interface/os: get_timeofday_us() -> time_us()

master
Perttu Ahola 2014-10-30 22:21:34 +02:00
parent 6156c82caf
commit a1610d5203
8 changed files with 11 additions and 11 deletions

View File

@ -418,12 +418,12 @@ struct Module: public interface::Module, public loader::Interface
if(event.name == "loader")
return;
m_modules_to_reload.insert(event.name);
m_last_module_modification_time = interface::os::get_timeofday_us();
m_last_module_modification_time = interface::os::time_us();
}
void on_tick(const interface::TickEvent &event)
{
int64_t t = interface::os::get_timeofday_us();
int64_t t = interface::os::time_us();
if(!m_modules_to_reload.empty() &&
t > m_last_module_modification_time + 1000000){
for(const ss_ &name : m_modules_to_reload){

View File

@ -82,7 +82,7 @@ struct Module: public interface::Module, public main_context::Interface
Module(interface::Server *server):
interface::Module(MODULE),
m_server(server),
profiler_last_print_us(interface::os::get_timeofday_us())
profiler_last_print_us(interface::os::time_us())
{
log_d(MODULE, "main_context construct");
}
@ -171,7 +171,7 @@ struct Module: public interface::Module, public main_context::Interface
m_engine->SetNextTimeStep(event.dtime);
m_engine->RunFrame();
uint64_t current_us = interface::os::get_timeofday_us();
uint64_t current_us = interface::os::time_us();
Profiler *p = m_context->GetSubsystem<Profiler>();
if(p && profiler_last_print_us < current_us - 10000000){
profiler_last_print_us = current_us;

View File

@ -54,12 +54,12 @@ struct ChunkBuffer
ChunkBuffer(){}
void timer_reset(const pv::Vector3DInt32 &chunk_p_){
chunk_p = chunk_p_;
last_accessed_us = interface::os::get_timeofday_us();
last_accessed_us = interface::os::time_us();
}
bool unload_if_old(int64_t timeout_us){ // True if not loaded
if(!volume)
return true;
if(interface::os::get_timeofday_us() < last_accessed_us + timeout_us)
if(interface::os::time_us() < last_accessed_us + timeout_us)
return false;
log_t(MODULE, "Unloading chunk " PV3I_FORMAT, PV3I_PARAMS(chunk_p));
volume.reset();

View File

@ -53,7 +53,7 @@ void basic_init()
log_init();
log_set_max_level(CORE_VERBOSE);
srand(interface::os::get_timeofday_us());
srand(interface::os::time_us());
}
int main(int argc, char *argv[])

View File

@ -9,7 +9,7 @@
namespace interface {
namespace os {
int64_t get_timeofday_us()
int64_t time_us()
{
struct timeval tv;
gettimeofday(&tv, nullptr);

View File

@ -8,7 +8,7 @@
namespace interface {
namespace os {
int64_t get_timeofday_us()
int64_t time_us()
{
struct timeval tv;
gettimeofday(&tv, nullptr);

View File

@ -7,7 +7,7 @@ namespace interface
{
namespace os
{
int64_t get_timeofday_us();
int64_t time_us();
void sleep_us(int us);
ss_ get_current_exe_path();
}

View File

@ -73,7 +73,7 @@ void basic_init()
interface::debug::SigConfig debug_sig_config;
interface::debug::init_signal_handlers(debug_sig_config);
srand(interface::os::get_timeofday_us());
srand(interface::os::time_us());
}
int main(int argc, char *argv[])