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 #include "base/time.h" | 5 #include "base/time.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/third_party/nspr/prtime.h" | 7 #include "base/third_party/nspr/prtime.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
| 11 namespace base { |
| 12 |
11 // TimeDelta ------------------------------------------------------------------ | 13 // TimeDelta ------------------------------------------------------------------ |
12 | 14 |
13 // static | 15 // static |
14 TimeDelta TimeDelta::FromDays(int64 days) { | 16 TimeDelta TimeDelta::FromDays(int64 days) { |
15 return TimeDelta(days * Time::kMicrosecondsPerDay); | 17 return TimeDelta(days * Time::kMicrosecondsPerDay); |
16 } | 18 } |
17 | 19 |
18 // static | 20 // static |
19 TimeDelta TimeDelta::FromHours(int64 hours) { | 21 TimeDelta TimeDelta::FromHours(int64 hours) { |
20 return TimeDelta(hours * Time::kMicrosecondsPerHour); | 22 return TimeDelta(hours * Time::kMicrosecondsPerHour); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 PRTime result_time = 0; | 115 PRTime result_time = 0; |
114 PRStatus result = PR_ParseTimeString(ascii_time_string.c_str(), PR_FALSE, | 116 PRStatus result = PR_ParseTimeString(ascii_time_string.c_str(), PR_FALSE, |
115 &result_time); | 117 &result_time); |
116 if (PR_SUCCESS != result) | 118 if (PR_SUCCESS != result) |
117 return false; | 119 return false; |
118 result_time += kTimeTToMicrosecondsOffset; | 120 result_time += kTimeTToMicrosecondsOffset; |
119 *parsed_time = Time(result_time); | 121 *parsed_time = Time(result_time); |
120 return true; | 122 return true; |
121 } | 123 } |
122 | 124 |
| 125 } // namespace base |
OLD | NEW |