diff --git a/src/system.cpp b/src/system.cpp index d009646fd0..f9078bc1b8 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -112,15 +112,6 @@ handleSignal(int) // ignore } -int64_t -now() -{ - timeval tv = { 0, 0 }; - gettimeofday(&tv, 0); - return (static_cast(tv.tv_sec) * 1000) + - (static_cast(tv.tv_usec) / 1000); -} - void* run(void* r) { @@ -269,7 +260,7 @@ class MySystem: public System { pthread_mutex_unlock(&mutex); if (time) { - int64_t then = now() + time; + int64_t then = s->now() + time; timespec ts = { then / 1000, (then % 1000) * 1000 * 1000 }; int rv = pthread_cond_timedwait (&(t->condition), &(t->mutex), &ts); @@ -518,6 +509,13 @@ class MySystem: public System { ::exit(code); } + int64_t now() { + timeval tv = { 0, 0 }; + gettimeofday(&tv, 0); + return (static_cast(tv.tv_sec) * 1000) + + (static_cast(tv.tv_usec) / 1000); + } + virtual void abort() { ::abort(); } diff --git a/src/system.h b/src/system.h index de8afadf04..a1b4b3a4ae 100644 --- a/src/system.h +++ b/src/system.h @@ -67,6 +67,7 @@ class System: public Allocator { unsigned returnType) = 0; virtual Status load(Library**, const char* name, Library* next) = 0; virtual void exit(int code) = 0; + virtual int64_t now() = 0; virtual void abort() = 0; virtual void dispose() = 0;