Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Basic time formatting methods. These methods use the current locale | 5 // Basic time formatting methods. These methods use the current locale |
| 6 // formatting for displaying the time. | 6 // formatting for displaying the time. |
| 7 | 7 |
| 8 #ifndef BASE_I18N_TIME_FORMATTING_H_ | 8 #ifndef BASE_I18N_TIME_FORMATTING_H_ |
| 9 #define BASE_I18N_TIME_FORMATTING_H_ | 9 #define BASE_I18N_TIME_FORMATTING_H_ |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 // Formats a time in a friendly sentence format, e.g. | 70 // Formats a time in a friendly sentence format, e.g. |
| 71 // "Monday, March 6, 2008 2:44:30 PM". | 71 // "Monday, March 6, 2008 2:44:30 PM". |
| 72 BASE_I18N_EXPORT string16 TimeFormatFriendlyDateAndTime(const Time& time); | 72 BASE_I18N_EXPORT string16 TimeFormatFriendlyDateAndTime(const Time& time); |
| 73 | 73 |
| 74 // Formats a time in a friendly sentence format, e.g. | 74 // Formats a time in a friendly sentence format, e.g. |
| 75 // "Monday, March 6, 2008". | 75 // "Monday, March 6, 2008". |
| 76 BASE_I18N_EXPORT string16 TimeFormatFriendlyDate(const Time& time); | 76 BASE_I18N_EXPORT string16 TimeFormatFriendlyDate(const Time& time); |
| 77 | 77 |
| 78 // Formats a time duration of hours and minutes into various formats, e.g., | 78 // Formats a time duration of hours and minutes into various formats, e.g., |
| 79 // "3:07" or "3 hours, 7 minutes". See DurationFormatWidth for details. | 79 // "3:07" or "3 hours, 7 minutes". See DurationFormatWidth for details. |
| 80 BASE_I18N_EXPORT string16 TimeDurationFormat(const TimeDelta& time, | 80 // |
| 81 // Please don't use width = DURATION_WIDTH_NUMERIC when the time duration | |
| 82 // can possibly be larger than 24h, as the hour value will be cut below 24 | |
| 83 // after formatting. | |
| 84 // TODO (chengx): fix function output when width = DURATION_WIDTH_NUMERIC | |
|
dcheng
2016/12/21 23:28:57
Nit: no space between TODO and (
chengx
2016/12/22 21:42:55
Done.
| |
| 85 // (http://crbug.com/675791) | |
| 86 BASE_I18N_EXPORT string16 TimeDurationFormat(const TimeDelta time, | |
| 81 const DurationFormatWidth width); | 87 const DurationFormatWidth width); |
| 82 | 88 |
| 89 // Formats a time duration of hours, minutes and seconds into various formats, | |
| 90 // e.g., "3:07:30" or "3 hours, 7 minutes, 30 seconds". See DurationFormatWidth | |
| 91 // for details. | |
| 92 // | |
| 93 // Please don't use width = DURATION_WIDTH_NUMERIC when the time duration | |
| 94 // can possibly be larger than 24h, as the hour value will be cut below 24 | |
| 95 // after formatting. | |
| 96 // TODO (chengx): fix function output when width = DURATION_WIDTH_NUMERIC | |
| 97 // (http://crbug.com/675791) | |
| 98 BASE_I18N_EXPORT string16 | |
| 99 TimeDurationFormatWithSeconds(const TimeDelta time, | |
| 100 const DurationFormatWidth width); | |
| 101 | |
| 83 // Gets the hour clock type of the current locale. e.g. | 102 // Gets the hour clock type of the current locale. e.g. |
| 84 // k12HourClock (en-US). | 103 // k12HourClock (en-US). |
| 85 // k24HourClock (en-GB). | 104 // k24HourClock (en-GB). |
| 86 BASE_I18N_EXPORT HourClockType GetHourClockType(); | 105 BASE_I18N_EXPORT HourClockType GetHourClockType(); |
| 87 | 106 |
| 88 } // namespace base | 107 } // namespace base |
| 89 | 108 |
| 90 #endif // BASE_I18N_TIME_FORMATTING_H_ | 109 #endif // BASE_I18N_TIME_FORMATTING_H_ |
| OLD | NEW |