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

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

Issue 2392873002: Use largest supported date for cookies if timegm overflows
Patch Set: Created 4 years, 2 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 | « base/time/time.h ('k') | net/cookies/cookie_util.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 (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 <stdint.h> 7 #include <stdint.h>
8 #include <sys/time.h> 8 #include <sys/time.h>
9 #include <time.h> 9 #include <time.h>
10 #if defined(OS_ANDROID) && !defined(__LP64__) 10 #if defined(OS_ANDROID) && !defined(__LP64__)
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 331
332 if (ExplodedMostlyEquals(to_exploded, exploded)) { 332 if (ExplodedMostlyEquals(to_exploded, exploded)) {
333 *time = converted_time; 333 *time = converted_time;
334 return true; 334 return true;
335 } 335 }
336 336
337 *time = Time(0); 337 *time = Time(0);
338 return false; 338 return false;
339 } 339 }
340 340
341 Time Time::GetMaxPlatformTime() {
342 const int64_t max_seconds = (sizeof(SysTime) < sizeof(int64_t))
343 ? std::numeric_limits<SysTime>::max()
344 : std::numeric_limits<int32_t>::max();
345 int64_t milliseconds = max_seconds * kMillisecondsPerSecond;
346 milliseconds += (kMillisecondsPerSecond - 1);
347 return Time((milliseconds * kMicrosecondsPerMillisecond) +
348 kWindowsEpochDeltaMicroseconds);
349 }
350
341 // TimeTicks ------------------------------------------------------------------ 351 // TimeTicks ------------------------------------------------------------------
342 // static 352 // static
343 TimeTicks TimeTicks::Now() { 353 TimeTicks TimeTicks::Now() {
344 return TimeTicks(ClockNow(CLOCK_MONOTONIC)); 354 return TimeTicks(ClockNow(CLOCK_MONOTONIC));
345 } 355 }
346 356
347 // static 357 // static
348 TimeTicks::Clock TimeTicks::GetClock() { 358 TimeTicks::Clock TimeTicks::GetClock() {
349 return Clock::LINUX_CLOCK_MONOTONIC; 359 return Clock::LINUX_CLOCK_MONOTONIC;
350 } 360 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; 407 result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1;
398 return result; 408 return result;
399 } 409 }
400 int64_t us = us_ - kTimeTToMicrosecondsOffset; 410 int64_t us = us_ - kTimeTToMicrosecondsOffset;
401 result.tv_sec = us / Time::kMicrosecondsPerSecond; 411 result.tv_sec = us / Time::kMicrosecondsPerSecond;
402 result.tv_usec = us % Time::kMicrosecondsPerSecond; 412 result.tv_usec = us % Time::kMicrosecondsPerSecond;
403 return result; 413 return result;
404 } 414 }
405 415
406 } // namespace base 416 } // namespace base
OLDNEW
« no previous file with comments | « base/time/time.h ('k') | net/cookies/cookie_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698