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

Side by Side Diff: src/base/platform/time.h

Issue 526223002: Use Chrome compatible naming for compiler specifics. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: mips Created 6 years, 3 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 | « src/base/platform/semaphore-unittest.cc ('k') | src/base/platform/time.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project 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 #ifndef V8_BASE_PLATFORM_TIME_H_ 5 #ifndef V8_BASE_PLATFORM_TIME_H_
6 #define V8_BASE_PLATFORM_TIME_H_ 6 #define V8_BASE_PLATFORM_TIME_H_
7 7
8 #include <time.h> 8 #include <time.h>
9 #include <limits> 9 #include <limits>
10 10
(...skipping 12 matching lines...) Expand all
23 23
24 class Time; 24 class Time;
25 class TimeTicks; 25 class TimeTicks;
26 26
27 // ----------------------------------------------------------------------------- 27 // -----------------------------------------------------------------------------
28 // TimeDelta 28 // TimeDelta
29 // 29 //
30 // This class represents a duration of time, internally represented in 30 // This class represents a duration of time, internally represented in
31 // microseonds. 31 // microseonds.
32 32
33 class TimeDelta V8_FINAL { 33 class TimeDelta FINAL {
34 public: 34 public:
35 TimeDelta() : delta_(0) {} 35 TimeDelta() : delta_(0) {}
36 36
37 // Converts units of time to TimeDeltas. 37 // Converts units of time to TimeDeltas.
38 static TimeDelta FromDays(int days); 38 static TimeDelta FromDays(int days);
39 static TimeDelta FromHours(int hours); 39 static TimeDelta FromHours(int hours);
40 static TimeDelta FromMinutes(int minutes); 40 static TimeDelta FromMinutes(int minutes);
41 static TimeDelta FromSeconds(int64_t seconds); 41 static TimeDelta FromSeconds(int64_t seconds);
42 static TimeDelta FromMilliseconds(int64_t milliseconds); 42 static TimeDelta FromMilliseconds(int64_t milliseconds);
43 static TimeDelta FromMicroseconds(int64_t microseconds) { 43 static TimeDelta FromMicroseconds(int64_t microseconds) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 int64_t delta_; 151 int64_t delta_;
152 }; 152 };
153 153
154 154
155 // ----------------------------------------------------------------------------- 155 // -----------------------------------------------------------------------------
156 // Time 156 // Time
157 // 157 //
158 // This class represents an absolute point in time, internally represented as 158 // This class represents an absolute point in time, internally represented as
159 // microseconds (s/1,000,000) since 00:00:00 UTC, January 1, 1970. 159 // microseconds (s/1,000,000) since 00:00:00 UTC, January 1, 1970.
160 160
161 class Time V8_FINAL { 161 class Time FINAL {
162 public: 162 public:
163 static const int64_t kMillisecondsPerSecond = 1000; 163 static const int64_t kMillisecondsPerSecond = 1000;
164 static const int64_t kMicrosecondsPerMillisecond = 1000; 164 static const int64_t kMicrosecondsPerMillisecond = 1000;
165 static const int64_t kMicrosecondsPerSecond = kMicrosecondsPerMillisecond * 165 static const int64_t kMicrosecondsPerSecond = kMicrosecondsPerMillisecond *
166 kMillisecondsPerSecond; 166 kMillisecondsPerSecond;
167 static const int64_t kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60; 167 static const int64_t kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60;
168 static const int64_t kMicrosecondsPerHour = kMicrosecondsPerMinute * 60; 168 static const int64_t kMicrosecondsPerHour = kMicrosecondsPerMinute * 60;
169 static const int64_t kMicrosecondsPerDay = kMicrosecondsPerHour * 24; 169 static const int64_t kMicrosecondsPerDay = kMicrosecondsPerHour * 24;
170 static const int64_t kMicrosecondsPerWeek = kMicrosecondsPerDay * 7; 170 static const int64_t kMicrosecondsPerWeek = kMicrosecondsPerDay * 7;
171 static const int64_t kNanosecondsPerMicrosecond = 1000; 171 static const int64_t kNanosecondsPerMicrosecond = 1000;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // ----------------------------------------------------------------------------- 288 // -----------------------------------------------------------------------------
289 // TimeTicks 289 // TimeTicks
290 // 290 //
291 // This class represents an abstract time that is most of the time incrementing 291 // This class represents an abstract time that is most of the time incrementing
292 // for use in measuring time durations. It is internally represented in 292 // for use in measuring time durations. It is internally represented in
293 // microseconds. It can not be converted to a human-readable time, but is 293 // microseconds. It can not be converted to a human-readable time, but is
294 // guaranteed not to decrease (if the user changes the computer clock, 294 // guaranteed not to decrease (if the user changes the computer clock,
295 // Time::Now() may actually decrease or jump). But note that TimeTicks may 295 // Time::Now() may actually decrease or jump). But note that TimeTicks may
296 // "stand still", for example if the computer suspended. 296 // "stand still", for example if the computer suspended.
297 297
298 class TimeTicks V8_FINAL { 298 class TimeTicks FINAL {
299 public: 299 public:
300 TimeTicks() : ticks_(0) {} 300 TimeTicks() : ticks_(0) {}
301 301
302 // Platform-dependent tick count representing "right now." 302 // Platform-dependent tick count representing "right now."
303 // The resolution of this clock is ~1-15ms. Resolution varies depending 303 // The resolution of this clock is ~1-15ms. Resolution varies depending
304 // on hardware/operating system configuration. 304 // on hardware/operating system configuration.
305 // This method never returns a null TimeTicks. 305 // This method never returns a null TimeTicks.
306 static TimeTicks Now(); 306 static TimeTicks Now();
307 307
308 // Returns a platform-dependent high-resolution tick count. Implementation 308 // Returns a platform-dependent high-resolution tick count. Implementation
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 int64_t ticks_; 391 int64_t ticks_;
392 }; 392 };
393 393
394 inline TimeTicks operator+(const TimeDelta& delta, const TimeTicks& ticks) { 394 inline TimeTicks operator+(const TimeDelta& delta, const TimeTicks& ticks) {
395 return ticks + delta; 395 return ticks + delta;
396 } 396 }
397 397
398 } } // namespace v8::base 398 } } // namespace v8::base
399 399
400 #endif // V8_BASE_PLATFORM_TIME_H_ 400 #endif // V8_BASE_PLATFORM_TIME_H_
OLDNEW
« no previous file with comments | « src/base/platform/semaphore-unittest.cc ('k') | src/base/platform/time.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698