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

Side by Side Diff: base/time_posix.cc

Issue 10795083: Enable some parts of base that were previously disabled in base_untrusted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/threading/platform_thread_posix.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/time.h" 5 #include "base/time.h"
6 6
7 #include <sys/time.h> 7 #include <sys/time.h>
8 #include <time.h> 8 #include <time.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 10
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 milliseconds = seconds * kMillisecondsPerSecond + exploded.millisecond; 182 milliseconds = seconds * kMillisecondsPerSecond + exploded.millisecond;
183 } 183 }
184 184
185 // Adjust from Unix (1970) to Windows (1601) epoch. 185 // Adjust from Unix (1970) to Windows (1601) epoch.
186 return Time((milliseconds * kMicrosecondsPerMillisecond) + 186 return Time((milliseconds * kMicrosecondsPerMillisecond) +
187 kWindowsEpochDeltaMicroseconds); 187 kWindowsEpochDeltaMicroseconds);
188 } 188 }
189 189
190 // TimeTicks ------------------------------------------------------------------ 190 // TimeTicks ------------------------------------------------------------------
191 // FreeBSD 6 has CLOCK_MONOLITHIC but defines _POSIX_MONOTONIC_CLOCK to -1. 191 // FreeBSD 6 has CLOCK_MONOLITHIC but defines _POSIX_MONOTONIC_CLOCK to -1.
192 #if (defined(OS_POSIX) && \ 192 #if (defined(OS_POSIX) && !defined(OS_NACL) && \
193 defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0) || \ 193 defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0) || \
194 defined(OS_BSD) || defined(OS_ANDROID) 194 defined(OS_BSD) || defined(OS_ANDROID)
195 195
196 // static 196 // static
197 TimeTicks TimeTicks::Now() { 197 TimeTicks TimeTicks::Now() {
198 uint64_t absolute_micro; 198 uint64_t absolute_micro;
199 199
200 struct timespec ts; 200 struct timespec ts;
201 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { 201 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
202 NOTREACHED() << "clock_gettime(CLOCK_MONOTONIC) failed."; 202 NOTREACHED() << "clock_gettime(CLOCK_MONOTONIC) failed.";
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 struct timeval Time::ToTimeVal() const { 275 struct timeval Time::ToTimeVal() const {
276 struct timeval result; 276 struct timeval result;
277 int64 us = us_ - kTimeTToMicrosecondsOffset; 277 int64 us = us_ - kTimeTToMicrosecondsOffset;
278 result.tv_sec = us / Time::kMicrosecondsPerSecond; 278 result.tv_sec = us / Time::kMicrosecondsPerSecond;
279 result.tv_usec = us % Time::kMicrosecondsPerSecond; 279 result.tv_usec = us % Time::kMicrosecondsPerSecond;
280 return result; 280 return result;
281 } 281 }
282 282
283 } // namespace base 283 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/platform_thread_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698