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

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

Issue 25849004: Clean up unused constant globals (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chrome/app/breakpad_linux.cc Created 7 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 | Annotate | Revision Log
« no previous file with comments | « base/debug/stack_trace_posix.cc ('k') | chrome/app/breakpad_linux.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) 10 #if defined(OS_ANDROID)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 // Time ----------------------------------------------------------------------- 118 // Time -----------------------------------------------------------------------
119 119
120 // Windows uses a Gregorian epoch of 1601. We need to match this internally 120 // Windows uses a Gregorian epoch of 1601. We need to match this internally
121 // so that our time representations match across all platforms. See bug 14734. 121 // so that our time representations match across all platforms. See bug 14734.
122 // irb(main):010:0> Time.at(0).getutc() 122 // irb(main):010:0> Time.at(0).getutc()
123 // => Thu Jan 01 00:00:00 UTC 1970 123 // => Thu Jan 01 00:00:00 UTC 1970
124 // irb(main):011:0> Time.at(-11644473600).getutc() 124 // irb(main):011:0> Time.at(-11644473600).getutc()
125 // => Mon Jan 01 00:00:00 UTC 1601 125 // => Mon Jan 01 00:00:00 UTC 1601
126 static const int64 kWindowsEpochDeltaSeconds = GG_INT64_C(11644473600); 126 static const int64 kWindowsEpochDeltaSeconds = GG_INT64_C(11644473600);
127 static const int64 kWindowsEpochDeltaMilliseconds =
128 kWindowsEpochDeltaSeconds * Time::kMillisecondsPerSecond;
129 127
130 // static 128 // static
131 const int64 Time::kWindowsEpochDeltaMicroseconds = 129 const int64 Time::kWindowsEpochDeltaMicroseconds =
132 kWindowsEpochDeltaSeconds * Time::kMicrosecondsPerSecond; 130 kWindowsEpochDeltaSeconds * Time::kMicrosecondsPerSecond;
133 131
134 // Some functions in time.cc use time_t directly, so we provide an offset 132 // Some functions in time.cc use time_t directly, so we provide an offset
135 // to convert from time_t (Unix epoch) and internal (Windows epoch). 133 // to convert from time_t (Unix epoch) and internal (Windows epoch).
136 // static 134 // static
137 const int64 Time::kTimeTToMicrosecondsOffset = kWindowsEpochDeltaMicroseconds; 135 const int64 Time::kTimeTToMicrosecondsOffset = kWindowsEpochDeltaMicroseconds;
138 136
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; 338 result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1;
341 return result; 339 return result;
342 } 340 }
343 int64 us = us_ - kTimeTToMicrosecondsOffset; 341 int64 us = us_ - kTimeTToMicrosecondsOffset;
344 result.tv_sec = us / Time::kMicrosecondsPerSecond; 342 result.tv_sec = us / Time::kMicrosecondsPerSecond;
345 result.tv_usec = us % Time::kMicrosecondsPerSecond; 343 result.tv_usec = us % Time::kMicrosecondsPerSecond;
346 return result; 344 return result;
347 } 345 }
348 346
349 } // namespace base 347 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/stack_trace_posix.cc ('k') | chrome/app/breakpad_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698