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

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

Issue 1128203010: base: Remove the remaining usage GG_(U)INTn_C macros. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 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
« no previous file with comments | « base/time/time_mac.cc ('k') | base/time/time_unittest.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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // function for TimeTicks::Now() on Mac OS X. 130 // function for TimeTicks::Now() on Mac OS X.
131 131
132 // Time ----------------------------------------------------------------------- 132 // Time -----------------------------------------------------------------------
133 133
134 // Windows uses a Gregorian epoch of 1601. We need to match this internally 134 // Windows uses a Gregorian epoch of 1601. We need to match this internally
135 // so that our time representations match across all platforms. See bug 14734. 135 // so that our time representations match across all platforms. See bug 14734.
136 // irb(main):010:0> Time.at(0).getutc() 136 // irb(main):010:0> Time.at(0).getutc()
137 // => Thu Jan 01 00:00:00 UTC 1970 137 // => Thu Jan 01 00:00:00 UTC 1970
138 // irb(main):011:0> Time.at(-11644473600).getutc() 138 // irb(main):011:0> Time.at(-11644473600).getutc()
139 // => Mon Jan 01 00:00:00 UTC 1601 139 // => Mon Jan 01 00:00:00 UTC 1601
140 static const int64 kWindowsEpochDeltaSeconds = GG_INT64_C(11644473600); 140 static const int64 kWindowsEpochDeltaSeconds = INT64_C(11644473600);
141 141
142 // static 142 // static
143 const int64 Time::kWindowsEpochDeltaMicroseconds = 143 const int64 Time::kWindowsEpochDeltaMicroseconds =
144 kWindowsEpochDeltaSeconds * Time::kMicrosecondsPerSecond; 144 kWindowsEpochDeltaSeconds * Time::kMicrosecondsPerSecond;
145 145
146 // Some functions in time.cc use time_t directly, so we provide an offset 146 // Some functions in time.cc use time_t directly, so we provide an offset
147 // to convert from time_t (Unix epoch) and internal (Windows epoch). 147 // to convert from time_t (Unix epoch) and internal (Windows epoch).
148 // static 148 // static
149 const int64 Time::kTimeTToMicrosecondsOffset = kWindowsEpochDeltaMicroseconds; 149 const int64 Time::kTimeTToMicrosecondsOffset = kWindowsEpochDeltaMicroseconds;
150 150
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; 386 result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1;
387 return result; 387 return result;
388 } 388 }
389 int64 us = us_ - kTimeTToMicrosecondsOffset; 389 int64 us = us_ - kTimeTToMicrosecondsOffset;
390 result.tv_sec = us / Time::kMicrosecondsPerSecond; 390 result.tv_sec = us / Time::kMicrosecondsPerSecond;
391 result.tv_usec = us % Time::kMicrosecondsPerSecond; 391 result.tv_usec = us % Time::kMicrosecondsPerSecond;
392 return result; 392 return result;
393 } 393 }
394 394
395 } // namespace base 395 } // namespace base
OLDNEW
« no previous file with comments | « base/time/time_mac.cc ('k') | base/time/time_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698