OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "fpdfsdk/include/cpdfsdk_datetime.h" | 7 #include "fpdfsdk/include/cpdfsdk_datetime.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/fx_ext.h" |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 int GetTimeZoneInSeconds(int8_t tzhour, uint8_t tzminute) { | 13 int GetTimeZoneInSeconds(int8_t tzhour, uint8_t tzminute) { |
14 return (int)tzhour * 3600 + (int)tzminute * (tzhour >= 0 ? 60 : -60); | 14 return (int)tzhour * 3600 + (int)tzminute * (tzhour >= 0 ? 60 : -60); |
15 } | 15 } |
16 | 16 |
17 bool IsLeapYear(int16_t year) { | 17 bool IsLeapYear(int16_t year) { |
18 return ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))); | 18 return ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))); |
19 } | 19 } |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 m_hour = static_cast<uint8_t>(n / 3600); | 403 m_hour = static_cast<uint8_t>(n / 3600); |
404 m_hour %= 24; | 404 m_hour %= 24; |
405 n %= 3600; | 405 n %= 3600; |
406 m_minute = static_cast<uint8_t>(n / 60); | 406 m_minute = static_cast<uint8_t>(n / 60); |
407 m_second = static_cast<uint8_t>(n % 60); | 407 m_second = static_cast<uint8_t>(n % 60); |
408 if (days != 0) | 408 if (days != 0) |
409 AddDays(days); | 409 AddDays(days); |
410 | 410 |
411 return *this; | 411 return *this; |
412 } | 412 } |
OLD | NEW |