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

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

Issue 429743002: Make QPCValueToMicroseconds faster in case the value is less than 44 bits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Typo Created 6 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
« no previous file with comments | « no previous file | base/time/time_win.cc » ('j') | base/time/time_win_unittest.cc » ('J')
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 // Time represents an absolute point in coordinated universal time (UTC), 5 // Time represents an absolute point in coordinated universal time (UTC),
6 // internally represented as microseconds (s/1,000,000) since the Windows epoch 6 // internally represented as microseconds (s/1,000,000) since the Windows epoch
7 // (1601-01-01 00:00:00 UTC) (See http://crbug.com/14734). System-dependent 7 // (1601-01-01 00:00:00 UTC) (See http://crbug.com/14734). System-dependent
8 // clock interface routines are defined in time_PLATFORM.cc. 8 // clock interface routines are defined in time_PLATFORM.cc.
9 // 9 //
10 // TimeDelta represents a duration of time, internally represented in 10 // TimeDelta represents a duration of time, internally represented in
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 static const int64 kNanosecondsPerSecond = kNanosecondsPerMicrosecond * 223 static const int64 kNanosecondsPerSecond = kNanosecondsPerMicrosecond *
224 kMicrosecondsPerSecond; 224 kMicrosecondsPerSecond;
225 225
226 #if !defined(OS_WIN) 226 #if !defined(OS_WIN)
227 // On Mac & Linux, this value is the delta from the Windows epoch of 1601 to 227 // On Mac & Linux, this value is the delta from the Windows epoch of 1601 to
228 // the Posix delta of 1970. This is used for migrating between the old 228 // the Posix delta of 1970. This is used for migrating between the old
229 // 1970-based epochs to the new 1601-based ones. It should be removed from 229 // 1970-based epochs to the new 1601-based ones. It should be removed from
230 // this global header and put in the platform-specific ones when we remove the 230 // this global header and put in the platform-specific ones when we remove the
231 // migration code. 231 // migration code.
232 static const int64 kWindowsEpochDeltaMicroseconds; 232 static const int64 kWindowsEpochDeltaMicroseconds;
233 #else
234 // To avoid overflow in QPC to Microseconds calculations, since we multiplying
willchan no longer on Chromium 2014/08/01 22:41:55 grammar error at the end of the line. perhaps s/we
fmeawad 2014/08/05 22:20:09 Done.
235 // by kMicrosecondsPerSecond, then the QPC value should not exceed
236 // (2^63 - 1) / 1E6. If it exceeds that threshold, we divide then multiply.
237 static const int64 kQPCOverflowThreshold = 0x8637BD05AF7;
233 #endif 238 #endif
234 239
235 // Represents an exploded time that can be formatted nicely. This is kind of 240 // Represents an exploded time that can be formatted nicely. This is kind of
236 // like the Win32 SYSTEMTIME structure or the Unix "struct tm" with a few 241 // like the Win32 SYSTEMTIME structure or the Unix "struct tm" with a few
237 // additions and changes to prevent errors. 242 // additions and changes to prevent errors.
238 struct BASE_EXPORT Exploded { 243 struct BASE_EXPORT Exploded {
239 int year; // Four digit year "2007" 244 int year; // Four digit year "2007"
240 int month; // 1-based month (values 1 = January, etc.) 245 int month; // 1-based month (values 1 = January, etc.)
241 int day_of_week; // 0-based day of week (0 = Sunday, etc.) 246 int day_of_week; // 0-based day of week (0 = Sunday, etc.)
242 int day_of_month; // 1-based day of month (1-31) 247 int day_of_month; // 1-based day of month (1-31)
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 #endif 743 #endif
739 }; 744 };
740 745
741 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { 746 inline TimeTicks TimeDelta::operator+(TimeTicks t) const {
742 return TimeTicks(t.ticks_ + delta_); 747 return TimeTicks(t.ticks_ + delta_);
743 } 748 }
744 749
745 } // namespace base 750 } // namespace base
746 751
747 #endif // BASE_TIME_TIME_H_ 752 #endif // BASE_TIME_TIME_H_
OLDNEW
« no previous file with comments | « no previous file | base/time/time_win.cc » ('j') | base/time/time_win_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698