Chromium Code Reviews| Index: native_client_sdk/src/libraries/nacl_io/event_listener.cc |
| diff --git a/native_client_sdk/src/libraries/nacl_io/event_listener.cc b/native_client_sdk/src/libraries/nacl_io/event_listener.cc |
| index 8ad13bd5b31fcb976e5be223756c89bb5d19d407..9f006ae8a9355f82d5f1c084d998e8f23cee4069 100644 |
| --- a/native_client_sdk/src/libraries/nacl_io/event_listener.cc |
| +++ b/native_client_sdk/src/libraries/nacl_io/event_listener.cc |
| @@ -7,15 +7,41 @@ |
| #include <poll.h> |
| #include <pthread.h> |
| #include <stdio.h> |
| +#include <sys/time.h> |
| #include "nacl_io/error.h" |
| #include "nacl_io/event_listener.h" |
| #include "nacl_io/kernel_wrap.h" |
| #include "nacl_io/osstat.h" |
| +#include "nacl_io/ostime.h" |
| #include "nacl_io/osunistd.h" |
| #include "sdk_util/auto_lock.h" |
| +#ifdef WIN32 |
|
binji
2013/11/15 17:26:23
defined(WIN32)
Sam Clegg
2013/11/15 18:13:34
Done.
|
| + |
| +#define USECS_FROM_WIN_TO_TO_UNIX_EPOCH 11644473600000LL |
| +static uint64_t usec_since_epoch() { |
| + FILETIME ft; |
| + ULARGE_INTEGER ularge; |
| + GetSystemTimeAsFileTime(&ft); |
| + |
| + ularge.LowPart = ft.dwLowDateTime; |
| + ularge.HighPart = ft.dwHighDateTime; |
| + |
| + // Truncate to usec resolution. |
| + return ularge.QuadPart / 10; |
| +} |
| + |
| +#else |
| + |
| +static uint64_t usec_since_epoch() { |
|
binji
2013/11/15 17:26:23
thanks for moving this, it didn't make sense to pu
|
| + struct timeval tv; |
| + gettimeofday(&tv, NULL); |
| + return tv.tv_usec + (tv.tv_sec * 1000000); |
| +} |
| + |
| +#endif |
| namespace nacl_io { |