OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 else | 369 else |
370 dtStr += CFX_ByteString("+"); | 370 dtStr += CFX_ByteString("+"); |
371 memset(tempStr, 0, sizeof(tempStr)); | 371 memset(tempStr, 0, sizeof(tempStr)); |
372 FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02u'", abs(dt.tzHour), | 372 FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02u'", abs(dt.tzHour), |
373 dt.tzMinute); | 373 dt.tzMinute); |
374 dtStr += CFX_ByteString(tempStr); | 374 dtStr += CFX_ByteString(tempStr); |
375 return dtStr; | 375 return dtStr; |
376 } | 376 } |
377 | 377 |
378 void CPDFSDK_DateTime::ToSystemTime(FX_SYSTEMTIME& st) { | 378 void CPDFSDK_DateTime::ToSystemTime(FX_SYSTEMTIME& st) { |
379 CPDFSDK_DateTime dt = *this; | 379 time_t t = (time_t)(*this); |
380 time_t t = (time_t)dt; | |
381 struct tm* pTime = localtime(&t); | 380 struct tm* pTime = localtime(&t); |
382 if (pTime) { | 381 if (pTime) { |
383 st.wYear = (uint16_t)pTime->tm_year + 1900; | 382 st.wYear = (uint16_t)pTime->tm_year + 1900; |
384 st.wMonth = (uint16_t)pTime->tm_mon + 1; | 383 st.wMonth = (uint16_t)pTime->tm_mon + 1; |
385 st.wDay = (uint16_t)pTime->tm_mday; | 384 st.wDay = (uint16_t)pTime->tm_mday; |
386 st.wDayOfWeek = (uint16_t)pTime->tm_wday; | 385 st.wDayOfWeek = (uint16_t)pTime->tm_wday; |
387 st.wHour = (uint16_t)pTime->tm_hour; | 386 st.wHour = (uint16_t)pTime->tm_hour; |
388 st.wMinute = (uint16_t)pTime->tm_min; | 387 st.wMinute = (uint16_t)pTime->tm_min; |
389 st.wSecond = (uint16_t)pTime->tm_sec; | 388 st.wSecond = (uint16_t)pTime->tm_sec; |
390 st.wMilliseconds = 0; | 389 st.wMilliseconds = 0; |
391 } | 390 } |
392 } | 391 } |
393 | 392 |
394 CPDFSDK_DateTime CPDFSDK_DateTime::ToGMT() const { | 393 CPDFSDK_DateTime CPDFSDK_DateTime::ToGMT() const { |
395 CPDFSDK_DateTime dt = *this; | 394 CPDFSDK_DateTime new_dt = *this; |
396 dt.AddSeconds(-gAfxGetTimeZoneInSeconds(dt.dt.tzHour, dt.dt.tzMinute)); | 395 new_dt.AddSeconds( |
397 dt.dt.tzHour = 0; | 396 -gAfxGetTimeZoneInSeconds(new_dt.dt.tzHour, new_dt.dt.tzMinute)); |
398 dt.dt.tzMinute = 0; | 397 new_dt.dt.tzHour = 0; |
399 return dt; | 398 new_dt.dt.tzMinute = 0; |
| 399 return new_dt; |
400 } | 400 } |
401 | 401 |
402 CPDFSDK_DateTime& CPDFSDK_DateTime::AddDays(short days) { | 402 CPDFSDK_DateTime& CPDFSDK_DateTime::AddDays(short days) { |
403 if (days == 0) | 403 if (days == 0) |
404 return *this; | 404 return *this; |
405 | 405 |
406 int16_t y = dt.year, yy; | 406 int16_t y = dt.year, yy; |
407 uint8_t m = dt.month; | 407 uint8_t m = dt.month; |
408 uint8_t d = dt.day; | 408 uint8_t d = dt.day; |
409 int mdays, ydays, ldays; | 409 int mdays, ydays, ldays; |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 | 927 |
928 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { | 928 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
929 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; | 929 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
930 } | 930 } |
931 | 931 |
932 #ifdef PDF_ENABLE_XFA | 932 #ifdef PDF_ENABLE_XFA |
933 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { | 933 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { |
934 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; | 934 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; |
935 } | 935 } |
936 #endif // PDF_ENABLE_XFA | 936 #endif // PDF_ENABLE_XFA |
OLD | NEW |