Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: native_client_sdk/src/libraries/nacl_io/event_listener.cc

Issue 73083005: [NaCl SDK] Enable linux host build for nacl_io and nacl_io_tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 {

Powered by Google App Engine
This is Rietveld 408576698