OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkString.h" | 8 #include "SkString.h" |
9 #include "SkTime.h" | 9 #include "SkTime.h" |
10 | 10 |
11 void SkTime::DateTime::toISO8601(SkString* dst) const { | 11 void SkTime::DateTime::toISO8601(SkString* dst) const { |
12 if (dst) { | 12 if (dst) { |
13 int timeZoneMinutes = SkToInt(fTimeZoneMinutes); | 13 int timeZoneMinutes = SkToInt(fTimeZoneMinutes); |
14 char timezoneSign = timeZoneMinutes >= 0 ? '+' : '-'; | 14 char timezoneSign = timeZoneMinutes >= 0 ? '+' : '-'; |
15 int timeZoneHours = abs(timeZoneMinutes) / 60; | 15 int timeZoneHours = SkTAbs(timeZoneMinutes) / 60; |
16 timeZoneMinutes = abs(timeZoneMinutes) % 60; | 16 timeZoneMinutes = SkTAbs(timeZoneMinutes) % 60; |
17 dst->printf("%04u-%02u-%02uT%02u:%02u:%02u%c%02d:%02d", | 17 dst->printf("%04u-%02u-%02uT%02u:%02u:%02u%c%02d:%02d", |
18 static_cast<unsigned>(fYear), static_cast<unsigned>(fMonth), | 18 static_cast<unsigned>(fYear), static_cast<unsigned>(fMonth), |
19 static_cast<unsigned>(fDay), static_cast<unsigned>(fHour), | 19 static_cast<unsigned>(fDay), static_cast<unsigned>(fHour), |
20 static_cast<unsigned>(fMinute), | 20 static_cast<unsigned>(fMinute), |
21 static_cast<unsigned>(fSecond), timezoneSign, timeZoneHours, | 21 static_cast<unsigned>(fSecond), timezoneSign, timeZoneHours, |
22 timeZoneMinutes); | 22 timeZoneMinutes); |
23 } | 23 } |
24 } | 24 } |
OLD | NEW |