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

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

Issue 1988663002: Add: check exploded time is properly converted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handling local and utc times + unittests Created 4 years, 7 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) 2016 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>
11 #include <sstream> 11 #include <sstream>
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 bool Time::Exploded::HasValidValues() const { 337 bool Time::Exploded::HasValidValues() const {
338 return is_in_range(month, 1, 12) && 338 return is_in_range(month, 1, 12) &&
339 is_in_range(day_of_week, 0, 6) && 339 is_in_range(day_of_week, 0, 6) &&
340 is_in_range(day_of_month, 1, 31) && 340 is_in_range(day_of_month, 1, 31) &&
341 is_in_range(hour, 0, 23) && 341 is_in_range(hour, 0, 23) &&
342 is_in_range(minute, 0, 59) && 342 is_in_range(minute, 0, 59) &&
343 is_in_range(second, 0, 60) && 343 is_in_range(second, 0, 60) &&
344 is_in_range(millisecond, 0, 999); 344 is_in_range(millisecond, 0, 999);
345 } 345 }
346 346
347 bool Time::Exploded::operator!=(const Exploded& rhs) {
348 return (month != rhs.month || day_of_month != rhs.day_of_month ||
Mark Mentovai 2016/05/18 17:42:49 year?
maksims (do not use this acc) 2016/05/19 09:57:19 Done.
349 hour != rhs.hour || minute != rhs.minute || second != rhs.second ||
350 millisecond != rhs.millisecond);
Mark Mentovai 2016/05/18 17:42:49 The outer (parentheses) surround the entire expres
maksims (do not use this acc) 2016/05/19 09:57:19 Done.
351 }
352
347 } // namespace base 353 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698