| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Time represents an absolute point in time, internally represented as | 5 // Time represents an absolute point in time, internally represented as |
| 6 // microseconds (s/1,000,000) since a platform-dependent epoch. Each | 6 // microseconds (s/1,000,000) since a platform-dependent epoch. Each |
| 7 // platform's epoch, along with other system-dependent clock interface | 7 // platform's epoch, along with other system-dependent clock interface |
| 8 // routines, is defined in time_PLATFORM.cc. | 8 // routines, is defined in time_PLATFORM.cc. |
| 9 // | 9 // |
| 10 // TimeDelta represents a duration of time, internally represented in | 10 // TimeDelta represents a duration of time, internally represented in |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 static const int64 kMicrosecondsPerSecond = kMicrosecondsPerMillisecond * | 171 static const int64 kMicrosecondsPerSecond = kMicrosecondsPerMillisecond * |
| 172 kMillisecondsPerSecond; | 172 kMillisecondsPerSecond; |
| 173 static const int64 kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60; | 173 static const int64 kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60; |
| 174 static const int64 kMicrosecondsPerHour = kMicrosecondsPerMinute * 60; | 174 static const int64 kMicrosecondsPerHour = kMicrosecondsPerMinute * 60; |
| 175 static const int64 kMicrosecondsPerDay = kMicrosecondsPerHour * 24; | 175 static const int64 kMicrosecondsPerDay = kMicrosecondsPerHour * 24; |
| 176 static const int64 kMicrosecondsPerWeek = kMicrosecondsPerDay * 7; | 176 static const int64 kMicrosecondsPerWeek = kMicrosecondsPerDay * 7; |
| 177 static const int64 kNanosecondsPerMicrosecond = 1000; | 177 static const int64 kNanosecondsPerMicrosecond = 1000; |
| 178 static const int64 kNanosecondsPerSecond = kNanosecondsPerMicrosecond * | 178 static const int64 kNanosecondsPerSecond = kNanosecondsPerMicrosecond * |
| 179 kMicrosecondsPerSecond; | 179 kMicrosecondsPerSecond; |
| 180 | 180 |
| 181 #if !defined(OS_WIN) |
| 182 // On Mac & Linux, this value is the delta from the Windows epoch of 1601 to |
| 183 // the Posix delta of 1970. This is used for migrating between the old |
| 184 // 1970-based epochs to the new 1601-based ones. It should be removed from |
| 185 // this global header and put in the platform-specific ones when we remove the |
| 186 // migration code. |
| 187 static const int64 kWindowsEpochDeltaMicroseconds; |
| 188 #endif |
| 189 |
| 181 // Represents an exploded time that can be formatted nicely. This is kind of | 190 // Represents an exploded time that can be formatted nicely. This is kind of |
| 182 // like the Win32 SYSTEMTIME structure or the Unix "struct tm" with a few | 191 // like the Win32 SYSTEMTIME structure or the Unix "struct tm" with a few |
| 183 // additions and changes to prevent errors. | 192 // additions and changes to prevent errors. |
| 184 struct Exploded { | 193 struct Exploded { |
| 185 int year; // Four digit year "2007" | 194 int year; // Four digit year "2007" |
| 186 int month; // 1-based month (values 1 = January, etc.) | 195 int month; // 1-based month (values 1 = January, etc.) |
| 187 int day_of_week; // 0-based day of week (0 = Sunday, etc.) | 196 int day_of_week; // 0-based day of week (0 = Sunday, etc.) |
| 188 int day_of_month; // 1-based day of month (1-31) | 197 int day_of_month; // 1-based day of month (1-31) |
| 189 int hour; // Hour within the current day (0-23) | 198 int hour; // Hour within the current day (0-23) |
| 190 int minute; // Minute within the current hour (0-59) | 199 int minute; // Minute within the current hour (0-59) |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 #endif | 491 #endif |
| 483 }; | 492 }; |
| 484 | 493 |
| 485 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 494 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
| 486 return TimeTicks(t.ticks_ + delta_); | 495 return TimeTicks(t.ticks_ + delta_); |
| 487 } | 496 } |
| 488 | 497 |
| 489 } // namespace base | 498 } // namespace base |
| 490 | 499 |
| 491 #endif // BASE_TIME_H_ | 500 #endif // BASE_TIME_H_ |
| OLD | NEW |