OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 |
| 7 #ifndef FPDFSDK_INCLUDE_CPDFSDK_DATETIME_H_ |
| 8 #define FPDFSDK_INCLUDE_CPDFSDK_DATETIME_H_ |
| 9 |
| 10 #if _FX_OS_ == _FX_ANDROID_ |
| 11 #include "time.h" |
| 12 #else |
| 13 #include <ctime> |
| 14 #endif |
| 15 |
| 16 #include "fpdfsdk/cfx_systemhandler.h" |
| 17 |
| 18 class CPDFSDK_DateTime { |
| 19 public: |
| 20 CPDFSDK_DateTime(); |
| 21 explicit CPDFSDK_DateTime(const CFX_ByteString& dtStr); |
| 22 explicit CPDFSDK_DateTime(const FX_SYSTEMTIME& st); |
| 23 CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime); |
| 24 |
| 25 bool operator==(const CPDFSDK_DateTime& datetime) const; |
| 26 bool operator!=(const CPDFSDK_DateTime& datetime) const; |
| 27 |
| 28 CPDFSDK_DateTime& FromPDFDateTimeString(const CFX_ByteString& dtStr); |
| 29 CFX_ByteString ToCommonDateTimeString(); |
| 30 CFX_ByteString ToPDFDateTimeString(); |
| 31 void ToSystemTime(FX_SYSTEMTIME& st); |
| 32 time_t ToTime_t() const; |
| 33 CPDFSDK_DateTime ToGMT() const; |
| 34 CPDFSDK_DateTime& AddDays(short days); |
| 35 CPDFSDK_DateTime& AddSeconds(int seconds); |
| 36 |
| 37 void ResetDateTime(); |
| 38 |
| 39 private: |
| 40 struct FX_DATETIME { |
| 41 int16_t year; |
| 42 uint8_t month; |
| 43 uint8_t day; |
| 44 uint8_t hour; |
| 45 uint8_t minute; |
| 46 uint8_t second; |
| 47 int8_t tzHour; |
| 48 uint8_t tzMinute; |
| 49 } dt; |
| 50 }; |
| 51 |
| 52 #endif // FPDFSDK_INCLUDE_CPDFSDK_DATETIME_H_ |
OLD | NEW |