diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-13 19:01:16 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-13 19:01:16 +0000 |
commit | f6ee0cde751e6b816cc68ee296ffd7d3d7219229 (patch) | |
tree | a61490f53f619d3a2f3e840d74fdd4f7f108d4e4 /base/time_posix.cc | |
parent | ea2403dae8f7483adf700724707e125b7e5de494 (diff) | |
download | chromium_src-f6ee0cde751e6b816cc68ee296ffd7d3d7219229.zip chromium_src-f6ee0cde751e6b816cc68ee296ffd7d3d7219229.tar.gz chromium_src-f6ee0cde751e6b816cc68ee296ffd7d3d7219229.tar.bz2 |
Make time_posix.cc build in Native Client
Time handling in Native Client isn't quite as robust as on other posix systems.
This patch adds a handful of ifdefs to work around these limitations. I've
filed the underlying bugs with NaCl, but they aren't likely to be fixed until
after NaCl switches to glibc.
Review URL: http://codereview.chromium.org/6683025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77966 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/time_posix.cc')
-rw-r--r-- | base/time_posix.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/base/time_posix.cc b/base/time_posix.cc index c2750b8..e9ea434 100644 --- a/base/time_posix.cc +++ b/base/time_posix.cc @@ -109,8 +109,10 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) { timestruct.tm_wday = exploded.day_of_week; // mktime/timegm ignore this timestruct.tm_yday = 0; // mktime/timegm ignore this timestruct.tm_isdst = -1; // attempt to figure it out +#if !defined(OS_NACL) timestruct.tm_gmtoff = 0; // not a POSIX field, so mktime/timegm ignore timestruct.tm_zone = NULL; // not a POSIX field, so mktime/timegm ignore +#endif time_t seconds; if (is_local) @@ -179,6 +181,15 @@ TimeTicks TimeTicks::Now() { return TimeTicks(absolute_micro); } +#elif defined(OS_NACL) + +TimeTicks TimeTicks::Now() { + // Sadly, Native Client does not have _POSIX_TIMERS enabled in sys/features.h + // Apparently NaCl only has CLOCK_REALTIME: + // http://code.google.com/p/nativeclient/issues/detail?id=1159 + return TimeTicks(clock()); +} + #else // _POSIX_MONOTONIC_CLOCK #error No usable tick clock function on this platform. #endif // _POSIX_MONOTONIC_CLOCK |