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

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

Issue 1975533002: Change ui::Event::time_stamp from TimeDelta to TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
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/time.h" 5 #include "base/time/time.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <ios> 8 #include <ios>
9 #include <limits> 9 #include <limits>
10 #include <ostream> 10 #include <ostream>
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 } // namespace time_internal 130 } // namespace time_internal
131 131
132 std::ostream& operator<<(std::ostream& os, TimeDelta time_delta) { 132 std::ostream& operator<<(std::ostream& os, TimeDelta time_delta) {
133 return os << time_delta.InSecondsF() << "s"; 133 return os << time_delta.InSecondsF() << "s";
134 } 134 }
135 135
136 // Time ----------------------------------------------------------------------- 136 // Time -----------------------------------------------------------------------
137 137
138 // static 138 // static
139 Time Time::Max() {
140 return Time(std::numeric_limits<int64_t>::max());
141 }
142
143 // static
144 Time Time::FromTimeT(time_t tt) { 139 Time Time::FromTimeT(time_t tt) {
145 if (tt == 0) 140 if (tt == 0)
146 return Time(); // Preserve 0 so we can tell it doesn't exist. 141 return Time(); // Preserve 0 so we can tell it doesn't exist.
147 if (tt == std::numeric_limits<time_t>::max()) 142 if (tt == std::numeric_limits<time_t>::max())
148 return Max(); 143 return Max();
149 return Time(kTimeTToMicrosecondsOffset) + TimeDelta::FromSeconds(tt); 144 return Time(kTimeTToMicrosecondsOffset) + TimeDelta::FromSeconds(tt);
150 } 145 }
151 146
152 time_t Time::ToTimeT() const { 147 time_t Time::ToTimeT() const {
153 if (is_null()) 148 if (is_null())
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 return is_in_range(month, 1, 12) && 333 return is_in_range(month, 1, 12) &&
339 is_in_range(day_of_week, 0, 6) && 334 is_in_range(day_of_week, 0, 6) &&
340 is_in_range(day_of_month, 1, 31) && 335 is_in_range(day_of_month, 1, 31) &&
341 is_in_range(hour, 0, 23) && 336 is_in_range(hour, 0, 23) &&
342 is_in_range(minute, 0, 59) && 337 is_in_range(minute, 0, 59) &&
343 is_in_range(second, 0, 60) && 338 is_in_range(second, 0, 60) &&
344 is_in_range(millisecond, 0, 999); 339 is_in_range(millisecond, 0, 999);
345 } 340 }
346 341
347 } // namespace base 342 } // namespace base
OLDNEW
« no previous file with comments | « base/time/time.h ('k') | chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698