summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-20 10:11:25 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-20 14:53:38 +0000
commit20df310406636d19a3238ea300bf303a7cd44d2e (patch)
treead8d732f412993f542b85d117914f8967846adec
parent85f019a8e7d33cbba368a6c6b75fd091269e14a1 (diff)
downloadpdfium-20df310406636d19a3238ea300bf303a7cd44d2e.tar.xz
Cleanup fgas_datetime code
This CL removes unused methods, removes default params and moves static methods into an anonymous namespace. Change-Id: I9a0d9907b46907ababbfb8730f1f6c76002d238a Reviewed-on: https://pdfium-review.googlesource.com/3091 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r--xfa/fgas/localization/fgas_datetime.cpp511
-rw-r--r--xfa/fgas/localization/fgas_datetime.h367
-rw-r--r--xfa/fgas/localization/fgas_locale.cpp12
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.cpp7
-rw-r--r--xfa/fxfa/parser/xfa_localevalue.cpp3
5 files changed, 184 insertions, 716 deletions
diff --git a/xfa/fgas/localization/fgas_datetime.cpp b/xfa/fgas/localization/fgas_datetime.cpp
index 83000a4f20..0d5b2b9b45 100644
--- a/xfa/fgas/localization/fgas_datetime.cpp
+++ b/xfa/fgas/localization/fgas_datetime.cpp
@@ -13,6 +13,8 @@
#include <time.h>
#endif
+namespace {
+
const uint8_t g_FXDaysPerMonth[12] = {31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31};
const uint8_t g_FXDaysPerLeapMonth[12] = {31, 29, 31, 30, 31, 30,
@@ -30,78 +32,86 @@ const int64_t g_FXMillisecondsPerSecond = 1000;
const int64_t g_FXMillisecondsPerMinute = 60000;
const int64_t g_FXMillisecondsPerHour = 3600000;
const int64_t g_FXMillisecondsPerDay = 86400000;
-bool FX_IsLeapYear(int32_t iYear) {
- ASSERT(iYear != 0);
- return ((iYear % 4) == 0 && (iYear % 100) != 0) || (iYear % 400) == 0;
-}
-int32_t FX_DaysInYear(int32_t iYear) {
- ASSERT(iYear != 0);
- return FX_IsLeapYear(iYear) ? g_FXDaysPerLeapYear : g_FXDaysPerYear;
-}
-uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth) {
- ASSERT(iYear != 0);
- ASSERT(iMonth >= 1 && iMonth <= 12);
- const uint8_t* p =
- FX_IsLeapYear(iYear) ? g_FXDaysPerLeapMonth : g_FXDaysPerMonth;
- return p[iMonth - 1];
+
+int64_t GetDayOfAD(int64_t unitime) {
+ bool bBC = unitime < 0;
+ int64_t iDays = unitime / g_FXMillisecondsPerDay;
+ iDays += bBC ? -1 : 0;
+ if (bBC && (unitime % g_FXMillisecondsPerDay) == 0)
+ iDays++;
+ return iDays;
}
-static int32_t FX_DaysBeforeMonthInYear(int32_t iYear, uint8_t iMonth) {
+
+int32_t DaysBeforeMonthInYear(int32_t iYear, uint8_t iMonth) {
ASSERT(iYear != 0);
ASSERT(iMonth >= 1 && iMonth <= 12);
+
const int32_t* p =
FX_IsLeapYear(iYear) ? g_FXDaysBeforeLeapMonth : g_FXDaysBeforeMonth;
return p[iMonth - 1];
}
-static int64_t FX_DateToDays(int32_t iYear,
- uint8_t iMonth,
- uint8_t iDay,
- bool bIncludeThisDay = false) {
+
+int32_t DaysInYear(int32_t iYear) {
+ ASSERT(iYear != 0);
+ return FX_IsLeapYear(iYear) ? g_FXDaysPerLeapYear : g_FXDaysPerYear;
+}
+
+int64_t DateToDays(int32_t iYear,
+ uint8_t iMonth,
+ uint8_t iDay,
+ bool bIncludeThisDay) {
ASSERT(iYear != 0);
ASSERT(iMonth >= 1 && iMonth <= 12);
ASSERT(iDay >= 1 && iDay <= FX_DaysInMonth(iYear, iMonth));
- int64_t iDays = FX_DaysBeforeMonthInYear(iYear, iMonth);
+
+ int64_t iDays = DaysBeforeMonthInYear(iYear, iMonth);
iDays += iDay;
- if (!bIncludeThisDay) {
+ if (!bIncludeThisDay)
iDays--;
- }
+
if (iYear > 0) {
iYear--;
} else {
- iDays -= FX_DaysInYear(iYear);
+ iDays -= DaysInYear(iYear);
iYear++;
}
- return iDays + (int64_t)iYear * 365 + iYear / 4 - iYear / 100 + iYear / 400;
+ return iDays + static_cast<int64_t>(iYear) * 365 + iYear / 4 - iYear / 100 +
+ iYear / 400;
}
-static void FX_DaysToDate(int64_t iDays,
- int32_t& iYear,
- uint8_t& iMonth,
- uint8_t& iDay) {
+
+void DaysToDate(int64_t iDays,
+ int32_t* retYear,
+ uint8_t* retMonth,
+ uint8_t* retDay) {
bool bBC = iDays < 0;
- if (bBC) {
+ if (bBC)
iDays = -iDays;
- }
- iYear = 1;
- iMonth = 1;
- iDay = 1;
+
+ int32_t iYear = 1;
+ uint8_t iMonth = 1;
+ uint8_t iDay = 1;
if (iDays >= g_FXDaysPer400Years) {
- iYear += (int32_t)(iDays / g_FXDaysPer400Years * 400);
+ iYear += static_cast<int32_t>(iDays / g_FXDaysPer400Years * 400);
iDays %= g_FXDaysPer400Years;
}
+
if (iDays >= g_FXDaysPer100Years) {
if (iDays == g_FXDaysPer100Years * 4) {
iYear += 300;
iDays -= g_FXDaysPer100Years * 3;
} else {
- iYear += (int32_t)(iDays / g_FXDaysPer100Years * 100);
+ iYear += static_cast<int32_t>(iDays / g_FXDaysPer100Years * 100);
iDays %= g_FXDaysPer100Years;
}
}
+
if (iDays >= g_FXDaysPer4Years) {
- iYear += (int32_t)(iDays / g_FXDaysPer4Years * 4);
+ iYear += static_cast<int32_t>(iDays / g_FXDaysPer4Years * 4);
iDays %= g_FXDaysPer4Years;
}
+
while (true) {
- int32_t iYearDays = FX_DaysInYear(iYear);
+ int32_t iYearDays = DaysInYear(iYear);
if (iDays < iYearDays) {
if (bBC) {
iYear = -iYear;
@@ -114,13 +124,17 @@ static void FX_DaysToDate(int64_t iDays,
}
while (true) {
int32_t iMonthDays = FX_DaysInMonth(iYear, iMonth);
- if (iDays < iMonthDays) {
+ if (iDays < iMonthDays)
break;
- }
+
iMonth++;
iDays -= iMonthDays;
}
- iDay += (uint8_t)iDays;
+ iDay += static_cast<uint8_t>(iDays);
+
+ *retYear = iYear;
+ *retMonth = iMonth;
+ *retDay = iDay;
}
struct FXUT_SYSTEMTIME {
@@ -134,19 +148,31 @@ struct FXUT_SYSTEMTIME {
uint16_t wMilliseconds;
};
+} // namespace
+
+uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth) {
+ ASSERT(iYear != 0);
+ ASSERT(iMonth >= 1 && iMonth <= 12);
+
+ const uint8_t* p =
+ FX_IsLeapYear(iYear) ? g_FXDaysPerLeapMonth : g_FXDaysPerMonth;
+ return p[iMonth - 1];
+}
+
+bool FX_IsLeapYear(int32_t iYear) {
+ ASSERT(iYear != 0);
+ return ((iYear % 4) == 0 && (iYear % 100) != 0) || (iYear % 400) == 0;
+}
+
void CFX_Unitime::Now() {
FXUT_SYSTEMTIME utLocal;
#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
_FX_OS_ == _FX_WIN64_
::GetLocalTime((LPSYSTEMTIME)&utLocal);
#elif _FX_OS_ != _FX_EMBEDDED_
-#if 1
timeval curTime;
gettimeofday(&curTime, nullptr);
-#else
- struct timespec curTime;
- clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &curTime);
-#endif
+
struct tm st;
localtime_r(&curTime.tv_sec, &st);
utLocal.wYear = st.tm_year + 1900;
@@ -157,39 +183,15 @@ void CFX_Unitime::Now() {
utLocal.wMinute = st.tm_min;
utLocal.wSecond = st.tm_sec;
utLocal.wMilliseconds = curTime.tv_usec / 1000;
-#endif
- Set(utLocal.wYear, (uint8_t)utLocal.wMonth, (uint8_t)utLocal.wDay,
- (uint8_t)utLocal.wHour, (uint8_t)utLocal.wMinute,
- (uint8_t)utLocal.wSecond, (uint16_t)utLocal.wMilliseconds);
-}
-void CFX_Unitime::SetGMTime() {
- FXUT_SYSTEMTIME utLocal;
-#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
- _FX_OS_ == _FX_WIN64_
- ::GetSystemTime((LPSYSTEMTIME)&utLocal);
-#elif _FX_OS_ != _FX_EMBEDDED_
-#if 1
- timeval curTime;
- gettimeofday(&curTime, nullptr);
-#else
- struct timespec curTime;
- clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &curTime);
-#endif
- struct tm st;
- gmtime_r(&curTime.tv_sec, &st);
- utLocal.wYear = st.tm_year + 1900;
- utLocal.wMonth = st.tm_mon + 1;
- utLocal.wDayOfWeek = st.tm_wday;
- utLocal.wDay = st.tm_mday;
- utLocal.wHour = st.tm_hour;
- utLocal.wMinute = st.tm_min;
- utLocal.wSecond = st.tm_sec;
- utLocal.wMilliseconds = curTime.tv_usec / 1000;
-#endif
- Set(utLocal.wYear, (uint8_t)utLocal.wMonth, (uint8_t)utLocal.wDay,
- (uint8_t)utLocal.wHour, (uint8_t)utLocal.wMinute,
- (uint8_t)utLocal.wSecond, (uint16_t)utLocal.wMilliseconds);
+#endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
+ // _FX_OS_ == _FX_WIN64_
+ Set(utLocal.wYear, static_cast<uint8_t>(utLocal.wMonth),
+ static_cast<uint8_t>(utLocal.wDay), static_cast<uint8_t>(utLocal.wHour),
+ static_cast<uint8_t>(utLocal.wMinute),
+ static_cast<uint8_t>(utLocal.wSecond),
+ static_cast<uint16_t>(utLocal.wMilliseconds));
}
+
void CFX_Unitime::Set(int32_t year,
uint8_t month,
uint8_t day,
@@ -201,350 +203,87 @@ void CFX_Unitime::Set(int32_t year,
ASSERT(minute <= 59);
ASSERT(second <= 59);
ASSERT(millisecond <= 999);
- m_iUnitime = (int64_t)hour * g_FXMillisecondsPerHour +
- (int64_t)minute * g_FXMillisecondsPerMinute +
- (int64_t)second * g_FXMillisecondsPerSecond + millisecond;
- if (year > 0) {
- m_iUnitime =
- m_iUnitime +
- FX_DateToDays(year, month, day, false) * g_FXMillisecondsPerDay;
- }
-}
-void CFX_Unitime::Set(FX_UNITIME t) {
- m_iUnitime = t;
+
+ m_iUnitime = static_cast<int64_t>(hour) * g_FXMillisecondsPerHour +
+ static_cast<int64_t>(minute) * g_FXMillisecondsPerMinute +
+ static_cast<int64_t>(second) * g_FXMillisecondsPerSecond +
+ millisecond;
+ if (year <= 0)
+ return;
+
+ m_iUnitime += DateToDays(year, month, day, false) * g_FXMillisecondsPerDay;
}
+
int32_t CFX_Unitime::GetYear() const {
int32_t iYear;
uint8_t iMonth, iDay;
- FX_DaysToDate(GetDayOfAD(), iYear, iMonth, iDay);
+ DaysToDate(GetDayOfAD(m_iUnitime), &iYear, &iMonth, &iDay);
return iYear;
}
+
uint8_t CFX_Unitime::GetMonth() const {
int32_t iYear;
uint8_t iMonth, iDay;
- FX_DaysToDate(GetDayOfAD(), iYear, iMonth, iDay);
+ DaysToDate(GetDayOfAD(m_iUnitime), &iYear, &iMonth, &iDay);
return iMonth;
}
+
uint8_t CFX_Unitime::GetDay() const {
int32_t iYear;
uint8_t iMonth, iDay;
- FX_DaysToDate(GetDayOfAD(), iYear, iMonth, iDay);
+ DaysToDate(GetDayOfAD(m_iUnitime), &iYear, &iMonth, &iDay);
return iDay;
}
-FX_WEEKDAY CFX_Unitime::GetDayOfWeek() const {
- int32_t v = (int32_t)((m_iUnitime / g_FXMillisecondsPerDay + 1) % 7);
- if (v < 0) {
- v += 7;
- }
- return (FX_WEEKDAY)v;
-}
-uint16_t CFX_Unitime::GetDayOfYear() const {
- int32_t iYear;
- uint8_t iMonth, iDay;
- FX_DaysToDate(GetDayOfAD(), iYear, iMonth, iDay);
- return FX_DaysBeforeMonthInYear(iYear, iMonth) + iDay;
-}
-int64_t CFX_Unitime::GetDayOfAD() const {
- bool bBC = m_iUnitime < 0;
- int64_t iDays = m_iUnitime / g_FXMillisecondsPerDay;
- iDays += bBC ? -1 : 0;
- if (bBC && (m_iUnitime % g_FXMillisecondsPerDay) == 0) {
- iDays++;
- }
- return iDays;
-}
+
uint8_t CFX_Unitime::GetHour() const {
- int32_t v = (int32_t)(m_iUnitime % g_FXMillisecondsPerDay);
- if (v < 0) {
+ int32_t v = static_cast<int32_t>(m_iUnitime % g_FXMillisecondsPerDay);
+ if (v < 0)
v += g_FXMillisecondsPerDay;
- }
- return (uint8_t)(v / g_FXMillisecondsPerHour);
+ return static_cast<uint8_t>(v / g_FXMillisecondsPerHour);
}
+
uint8_t CFX_Unitime::GetMinute() const {
- int32_t v = (int32_t)(m_iUnitime % g_FXMillisecondsPerHour);
- if (v < 0) {
+ int32_t v = static_cast<int32_t>(m_iUnitime % g_FXMillisecondsPerHour);
+ if (v < 0)
v += g_FXMillisecondsPerHour;
- }
- return (uint8_t)(v / g_FXMillisecondsPerMinute);
+ return static_cast<uint8_t>(v / g_FXMillisecondsPerMinute);
}
+
uint8_t CFX_Unitime::GetSecond() const {
- int32_t v = (int32_t)(m_iUnitime % g_FXMillisecondsPerMinute);
- if (v < 0) {
+ int32_t v = static_cast<int32_t>(m_iUnitime % g_FXMillisecondsPerMinute);
+ if (v < 0)
v += g_FXMillisecondsPerMinute;
- }
- return (uint8_t)(v / g_FXMillisecondsPerSecond);
+ return static_cast<uint8_t>(v / g_FXMillisecondsPerSecond);
}
+
uint16_t CFX_Unitime::GetMillisecond() const {
- int32_t v = (int32_t)(m_iUnitime % g_FXMillisecondsPerSecond);
- if (v < 0) {
+ int32_t v = static_cast<int32_t>(m_iUnitime % g_FXMillisecondsPerSecond);
+ if (v < 0)
v += g_FXMillisecondsPerSecond;
- }
- return (uint16_t)v;
-}
-bool CFX_Unitime::AddYears(int32_t iYears) {
- FX_UNITIME ut = m_iUnitime;
- if (ut < 0) {
- ut = -ut;
- }
- FX_UNITIME r = ut % g_FXMillisecondsPerDay;
- int32_t iYear;
- uint8_t iMonth, iDay;
- FX_DaysToDate(GetDayOfAD(), iYear, iMonth, iDay);
- iYear += iYears;
- if (iYear == 0) {
- iYear = iYears > 0 ? 1 : -1;
- }
- m_iUnitime =
- FX_DateToDays(iYear, iMonth, iDay, false) * g_FXMillisecondsPerDay;
- m_iUnitime += (iYear < 0) ? -r : r;
- return true;
-}
-bool CFX_Unitime::AddMonths(int32_t iMonths) {
- bool b = iMonths > 0;
- FX_UNITIME ut = m_iUnitime;
- if (ut < 0) {
- ut = -ut;
- }
- FX_UNITIME r = ut % g_FXMillisecondsPerDay;
- int32_t iYear;
- uint8_t iMonth, iDay;
- FX_DaysToDate(GetDayOfAD(), iYear, iMonth, iDay);
- iMonths += iMonth;
- while (iMonths < 1) {
- iYear--, iMonths += 12;
- }
- while (iMonths > 12) {
- iYear++, iMonths -= 12;
- }
- if (iYear == 0) {
- iYear = b ? 1 : -1;
- }
- m_iUnitime = FX_DateToDays(iYear, (uint8_t)iMonths, iDay, false) *
- g_FXMillisecondsPerDay;
- m_iUnitime += (iYear < 0) ? -r : r;
- return true;
+ return static_cast<uint16_t>(v);
}
-bool CFX_Unitime::AddDays(int32_t iDays) {
- m_iUnitime += (int64_t)iDays * g_FXMillisecondsPerDay;
- return true;
-}
-bool CFX_Unitime::AddHours(int32_t iHours) {
- m_iUnitime += (int64_t)iHours * g_FXMillisecondsPerHour;
- return true;
-}
-bool CFX_Unitime::AddMinutes(int32_t iMinutes) {
- m_iUnitime += (int64_t)iMinutes * g_FXMillisecondsPerMinute;
- return true;
-}
-bool CFX_Unitime::AddSeconds(int32_t iSeconds) {
- m_iUnitime += ((int64_t)iSeconds) * g_FXMillisecondsPerSecond;
- return true;
-}
-bool CFX_Unitime::AddMilliseconds(int32_t iMilliseconds) {
- m_iUnitime += iMilliseconds;
- return true;
-}
-bool CFX_DateTime::Set(int32_t year,
- uint8_t month,
- uint8_t day,
- uint8_t hour,
- uint8_t minute,
- uint8_t second,
- uint16_t millisecond) {
+
+bool CFX_DateTime::Set(int32_t year, uint8_t month, uint8_t day) {
ASSERT(year != 0);
ASSERT(month >= 1 && month <= 12);
ASSERT(day >= 1 && day <= FX_DaysInMonth(year, month));
- ASSERT(hour <= 23);
- ASSERT(minute <= 59);
- ASSERT(second <= 59);
- ASSERT(millisecond <= 999);
+
m_DateTime.Date.sDate.year = year;
m_DateTime.Date.sDate.month = month;
m_DateTime.Date.sDate.day = day;
- m_DateTime.Time.sTime.hour = hour;
- m_DateTime.Time.sTime.minute = minute;
- m_DateTime.Time.sTime.second = second;
- m_DateTime.Time.sTime.millisecond = millisecond;
- return true;
-}
-bool CFX_DateTime::FromUnitime(FX_UNITIME t) {
- CFX_Unitime ut(t);
- FX_DaysToDate(ut.GetDayOfAD(), m_DateTime.Date.sDate.year,
- m_DateTime.Date.sDate.month, m_DateTime.Date.sDate.day);
- m_DateTime.Date.sDate.day = ut.GetHour();
- m_DateTime.Time.sTime.minute = ut.GetMinute();
- m_DateTime.Time.sTime.second = ut.GetSecond();
- m_DateTime.Time.sTime.millisecond = ut.GetMillisecond();
+ m_DateTime.Time.sTime.hour = 0;
+ m_DateTime.Time.sTime.minute = 0;
+ m_DateTime.Time.sTime.second = 0;
+ m_DateTime.Time.sTime.millisecond = 0;
return true;
}
-FX_UNITIME CFX_DateTime::ToUnitime() const {
- FX_UNITIME v =
- (int64_t)m_DateTime.Date.sDate.day * g_FXMillisecondsPerHour +
- (int64_t)m_DateTime.Time.sTime.minute * g_FXMillisecondsPerMinute +
- (int64_t)m_DateTime.Time.sTime.second * g_FXMillisecondsPerSecond +
- m_DateTime.Time.sTime.millisecond;
- v += FX_DateToDays(m_DateTime.Date.sDate.year, m_DateTime.Date.sDate.month,
- m_DateTime.Date.sDate.day, false) *
- g_FXMillisecondsPerDay;
- return v;
-}
-int32_t CFX_DateTime::GetYear() const {
- return m_DateTime.Date.sDate.year;
-}
-uint8_t CFX_DateTime::GetMonth() const {
- return m_DateTime.Date.sDate.month;
-}
-uint8_t CFX_DateTime::GetDay() const {
- return m_DateTime.Date.sDate.day;
-}
-FX_WEEKDAY CFX_DateTime::GetDayOfWeek() const {
- int32_t v = (int32_t)(FX_DateToDays(m_DateTime.Date.sDate.year,
- m_DateTime.Date.sDate.month,
- m_DateTime.Date.sDate.day, true) %
- 7);
- if (v < 0) {
+
+int32_t CFX_DateTime::GetDayOfWeek() const {
+ int32_t v = static_cast<int32_t>(DateToDays(m_DateTime.Date.sDate.year,
+ m_DateTime.Date.sDate.month,
+ m_DateTime.Date.sDate.day, true) %
+ 7);
+ if (v < 0)
v += 7;
- }
- return (FX_WEEKDAY)v;
-}
-uint16_t CFX_DateTime::GetDayOfYear() const {
- return FX_DaysBeforeMonthInYear(m_DateTime.Date.sDate.year,
- m_DateTime.Date.sDate.month) +
- m_DateTime.Date.sDate.day;
-}
-int64_t CFX_DateTime::GetDayOfAD() const {
- return FX_DateToDays(m_DateTime.Date.sDate.year, m_DateTime.Date.sDate.month,
- m_DateTime.Date.sDate.day, true);
-}
-uint8_t CFX_DateTime::GetHour() const {
- return m_DateTime.Date.sDate.day;
-}
-uint8_t CFX_DateTime::GetMinute() const {
- return m_DateTime.Time.sTime.minute;
-}
-uint8_t CFX_DateTime::GetSecond() const {
- return m_DateTime.Time.sTime.second;
-}
-uint16_t CFX_DateTime::GetMillisecond() const {
- return m_DateTime.Time.sTime.millisecond;
-}
-bool CFX_DateTime::AddYears(int32_t iYears) {
- if (iYears == 0) {
- return false;
- }
- int32_t v = m_DateTime.Date.sDate.year + iYears;
- if (v >= 0 && m_DateTime.Date.sDate.year < 0) {
- v++;
- } else if (v <= 0 && m_DateTime.Date.sDate.year > 0) {
- v--;
- }
- m_DateTime.Date.sDate.year = v;
- return true;
-}
-bool CFX_DateTime::AddMonths(int32_t iMonths) {
- if (iMonths == 0) {
- return false;
- }
- bool b = iMonths > 0;
- iMonths += m_DateTime.Date.sDate.month;
- while (iMonths < 1) {
- m_DateTime.Date.sDate.year--;
- if (m_DateTime.Date.sDate.year == 0) {
- m_DateTime.Date.sDate.year = -1;
- }
- iMonths += 12;
- }
- while (iMonths > 12) {
- m_DateTime.Date.sDate.year++;
- if (m_DateTime.Date.sDate.year == 0) {
- m_DateTime.Date.sDate.year = 1;
- }
- iMonths -= 12;
- }
- if (m_DateTime.Date.sDate.year == 0) {
- m_DateTime.Date.sDate.year = b ? 1 : -1;
- }
- m_DateTime.Date.sDate.month = (uint8_t)iMonths;
- return true;
-}
-bool CFX_DateTime::AddDays(int32_t iDays) {
- if (iDays == 0) {
- return false;
- }
- int64_t v1 =
- FX_DateToDays(m_DateTime.Date.sDate.year, m_DateTime.Date.sDate.month,
- m_DateTime.Date.sDate.day, true);
- int64_t v2 = v1 + iDays;
- if (v2 <= 0 && v1 > 0) {
- v2--;
- } else if (v2 >= 0 && v1 < 0) {
- v2++;
- }
- FX_DaysToDate(v2, m_DateTime.Date.sDate.year, m_DateTime.Date.sDate.month,
- m_DateTime.Date.sDate.day);
- return true;
-}
-bool CFX_DateTime::AddHours(int32_t iHours) {
- if (iHours == 0) {
- return false;
- }
- iHours += m_DateTime.Date.sDate.day;
- int32_t iDays = iHours / 24;
- iHours %= 24;
- if (iHours < 0) {
- iDays--, iHours += 24;
- }
- m_DateTime.Date.sDate.day = (uint8_t)iHours;
- if (iDays != 0) {
- AddDays(iDays);
- }
- return true;
-}
-bool CFX_DateTime::AddMinutes(int32_t iMinutes) {
- if (iMinutes == 0) {
- return false;
- }
- iMinutes += m_DateTime.Time.sTime.minute;
- int32_t iHours = iMinutes / 60;
- iMinutes %= 60;
- if (iMinutes < 0) {
- iHours--, iMinutes += 60;
- }
- m_DateTime.Time.sTime.minute = (uint8_t)iMinutes;
- if (iHours != 0) {
- AddHours(iHours);
- }
- return true;
-}
-bool CFX_DateTime::AddSeconds(int32_t iSeconds) {
- if (iSeconds == 0) {
- return false;
- }
- iSeconds += m_DateTime.Time.sTime.second;
- int32_t iMinutes = iSeconds / 60;
- iSeconds %= 60;
- if (iSeconds < 0) {
- iMinutes--, iSeconds += 60;
- }
- m_DateTime.Time.sTime.second = (uint8_t)iSeconds;
- if (iMinutes != 0) {
- AddMinutes(iMinutes);
- }
- return true;
-}
-bool CFX_DateTime::AddMilliseconds(int32_t iMilliseconds) {
- if (iMilliseconds == 0) {
- return false;
- }
- iMilliseconds += m_DateTime.Time.sTime.millisecond;
- int32_t iSeconds = (int32_t)(iMilliseconds / g_FXMillisecondsPerSecond);
- iMilliseconds %= g_FXMillisecondsPerSecond;
- if (iMilliseconds < 0) {
- iSeconds--, iMilliseconds += g_FXMillisecondsPerSecond;
- }
- m_DateTime.Time.sTime.millisecond = (uint16_t)iMilliseconds;
- if (iSeconds != 0) {
- AddSeconds(iSeconds);
- }
- return true;
+ return v;
}
diff --git a/xfa/fgas/localization/fgas_datetime.h b/xfa/fgas/localization/fgas_datetime.h
index d3ea9fa4a6..1f9f19d2c1 100644
--- a/xfa/fgas/localization/fgas_datetime.h
+++ b/xfa/fgas/localization/fgas_datetime.h
@@ -12,199 +12,49 @@
class CFX_Unitime;
class CFX_DateTime;
-typedef int64_t FX_UNITIME;
-enum FX_WEEKDAY {
- FX_Sunday = 0,
- FX_Monday,
- FX_Tuesday,
- FX_Wednesday,
- FX_Thursday,
- FX_Friday,
- FX_Saturday,
-};
-
bool FX_IsLeapYear(int32_t iYear);
-int32_t FX_DaysInYear(int32_t iYear);
uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth);
class CFX_Unitime {
public:
CFX_Unitime() { m_iUnitime = 0; }
- explicit CFX_Unitime(FX_UNITIME iUnitime) { m_iUnitime = iUnitime; }
- CFX_Unitime(const CFX_Unitime& unitime) { m_iUnitime = unitime.m_iUnitime; }
- operator FX_UNITIME*() { return &m_iUnitime; }
- operator FX_UNITIME const*() const { return &m_iUnitime; }
- operator FX_UNITIME&() { return m_iUnitime; }
- operator const FX_UNITIME&() const { return m_iUnitime; }
- CFX_Unitime& operator=(const CFX_Unitime& t) {
- m_iUnitime = t.m_iUnitime;
- return *this;
- }
- CFX_Unitime& operator=(FX_UNITIME t) {
- m_iUnitime = t;
- return *this;
- }
- CFX_Unitime& operator+=(const CFX_Unitime& t) {
- m_iUnitime += t.m_iUnitime;
- return *this;
- }
- CFX_Unitime& operator+=(FX_UNITIME t) {
- m_iUnitime += t;
- return *this;
- }
- CFX_Unitime& operator-=(const CFX_Unitime& t) {
- m_iUnitime -= t.m_iUnitime;
- return *this;
- }
- CFX_Unitime& operator-=(FX_UNITIME t) {
- m_iUnitime -= t;
- return *this;
- }
+ explicit CFX_Unitime(int64_t iUnitime) { m_iUnitime = iUnitime; }
+
+ int64_t ToInt64() const { return m_iUnitime; }
+
void Now();
- void SetGMTime();
void Set(int32_t year,
uint8_t month,
uint8_t day,
- uint8_t hour = 0,
- uint8_t minute = 0,
- uint8_t second = 0,
- uint16_t millisecond = 0);
- void Set(FX_UNITIME t);
+ uint8_t hour,
+ uint8_t minute,
+ uint8_t second,
+ uint16_t millisecond);
+ void Set(int64_t t) { m_iUnitime = t; }
+
int32_t GetYear() const;
uint8_t GetMonth() const;
uint8_t GetDay() const;
- FX_WEEKDAY GetDayOfWeek() const;
- uint16_t GetDayOfYear() const;
- int64_t GetDayOfAD() const;
uint8_t GetHour() const;
uint8_t GetMinute() const;
uint8_t GetSecond() const;
uint16_t GetMillisecond() const;
- bool AddYears(int32_t iYears);
- bool AddMonths(int32_t iMonths);
- bool AddDays(int32_t iDays);
- bool AddHours(int32_t iHours);
- bool AddMinutes(int32_t iMinutes);
- bool AddSeconds(int32_t iSeconds);
- bool AddMilliseconds(int32_t iMilliseconds);
- friend CFX_Unitime operator+(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return CFX_Unitime(t1.m_iUnitime + t2.m_iUnitime);
- }
- friend CFX_Unitime operator+(const CFX_Unitime& t1, FX_UNITIME t2) {
- return CFX_Unitime(t1.m_iUnitime + t2);
- }
- friend CFX_Unitime operator+(FX_UNITIME t1, const CFX_Unitime& t2) {
- return CFX_Unitime(t1 + t2.m_iUnitime);
- }
- friend CFX_Unitime operator-(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return CFX_Unitime(t1.m_iUnitime + t2.m_iUnitime);
- }
- friend CFX_Unitime operator-(const CFX_Unitime& t1, FX_UNITIME t2) {
- return CFX_Unitime(t1.m_iUnitime + t2);
- }
- friend CFX_Unitime operator-(FX_UNITIME t1, const CFX_Unitime& t2) {
- return CFX_Unitime(t1 + t2.m_iUnitime);
- }
- friend bool operator==(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return t1.m_iUnitime == t2.m_iUnitime;
- }
- friend bool operator==(const CFX_Unitime& t1, FX_UNITIME t2) {
- return t1.m_iUnitime == t2;
- }
- friend bool operator==(FX_UNITIME t1, const CFX_Unitime& t2) {
- return t1 == t2.m_iUnitime;
- }
- friend bool operator!=(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return t1.m_iUnitime != t2.m_iUnitime;
- }
- friend bool operator!=(const CFX_Unitime& t1, FX_UNITIME t2) {
- return t1.m_iUnitime != t2;
- }
- friend bool operator!=(FX_UNITIME t1, const CFX_Unitime& t2) {
- return t1 != t2.m_iUnitime;
- }
- friend bool operator>(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return t1.m_iUnitime > t2.m_iUnitime;
- }
- friend bool operator>(const CFX_Unitime& t1, FX_UNITIME t2) {
- return t1.m_iUnitime > t2;
- }
- friend bool operator>(FX_UNITIME t1, const CFX_Unitime& t2) {
- return t1 > t2.m_iUnitime;
- }
- friend bool operator>=(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return t1.m_iUnitime >= t2.m_iUnitime;
- }
- friend bool operator>=(const CFX_Unitime& t1, FX_UNITIME t2) {
- return t1.m_iUnitime >= t2;
- }
- friend bool operator>=(FX_UNITIME t1, const CFX_Unitime& t2) {
- return t1 >= t2.m_iUnitime;
- }
- friend bool operator<(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return t1.m_iUnitime < t2.m_iUnitime;
- }
- friend bool operator<(const CFX_Unitime& t1, FX_UNITIME t2) {
- return t1.m_iUnitime < t2;
- }
- friend bool operator<(FX_UNITIME t1, const CFX_Unitime& t2) {
- return t1 < t2.m_iUnitime;
- }
- friend bool operator<=(const CFX_Unitime& t1, const CFX_Unitime& t2) {
- return t1.m_iUnitime <= t2.m_iUnitime;
- }
- friend bool operator<=(const CFX_Unitime& t1, FX_UNITIME t2) {
- return t1.m_iUnitime <= t2;
- }
- friend bool operator<=(FX_UNITIME t1, const CFX_Unitime& t2) {
- return t1 <= t2.m_iUnitime;
+
+ CFX_Unitime operator+(const CFX_Unitime& t2) const {
+ return CFX_Unitime(m_iUnitime + t2.m_iUnitime);
}
private:
- FX_UNITIME m_iUnitime;
+ int64_t m_iUnitime;
};
#if _FX_OS_ != _FX_ANDROID_
#pragma pack(push, 1)
#endif
-struct FX_DATE {
- int32_t year;
- uint8_t month;
- uint8_t day;
-};
-
-struct FX_TIME {
- uint8_t hour;
- uint8_t minute;
- uint8_t second;
- uint16_t millisecond;
-};
-
struct FX_TIMEZONE {
int8_t tzHour;
uint8_t tzMinute;
};
-
-struct FX_DATETIME {
- union {
- struct {
- int32_t year;
- uint8_t month;
- uint8_t day;
- } sDate;
- FX_DATE aDate;
- } Date;
- union {
- struct {
- uint8_t hour;
- uint8_t minute;
- uint8_t second;
- uint16_t millisecond;
- } sTime;
- FX_TIME aTime;
- } Time;
-};
-
#if _FX_OS_ != _FX_ANDROID_
#pragma pack(pop)
#endif
@@ -212,163 +62,42 @@ struct FX_DATETIME {
class CFX_DateTime {
public:
CFX_DateTime() {}
- explicit CFX_DateTime(const FX_DATETIME& dt) { m_DateTime = dt; }
- CFX_DateTime(const CFX_DateTime& dt) { m_DateTime = dt.m_DateTime; }
- virtual ~CFX_DateTime() {}
- operator FX_DATETIME*() { return &m_DateTime; }
- operator const FX_DATETIME*() const { return &m_DateTime; }
- operator FX_DATETIME&() { return m_DateTime; }
- operator const FX_DATETIME&() const { return m_DateTime; }
- CFX_DateTime& operator=(const CFX_DateTime& dt) {
- m_DateTime = dt.m_DateTime;
- return *this;
- }
- CFX_DateTime& operator=(const FX_DATETIME& dt) {
- m_DateTime = dt;
- return *this;
- }
- CFX_DateTime& operator+=(const CFX_DateTime& dt) {
- FromUnitime(ToUnitime() + dt.ToUnitime());
- return *this;
- }
- CFX_DateTime& operator+=(const FX_DATETIME& dt) {
- FromUnitime(ToUnitime() + ((const CFX_DateTime&)dt).ToUnitime());
- return *this;
- }
- CFX_DateTime& operator-=(const CFX_DateTime& dt) {
- FromUnitime(ToUnitime() - dt.ToUnitime());
- return *this;
- }
- CFX_DateTime& operator-=(const FX_DATETIME& dt) {
- FromUnitime(ToUnitime() - ((const CFX_DateTime&)dt).ToUnitime());
- return *this;
- }
- virtual bool Set(int32_t year,
- uint8_t month,
- uint8_t day,
- uint8_t hour = 0,
- uint8_t minute = 0,
- uint8_t second = 0,
- uint16_t millisecond = 0);
- virtual bool FromUnitime(FX_UNITIME t);
- virtual FX_UNITIME ToUnitime() const;
- virtual int32_t GetYear() const;
- virtual uint8_t GetMonth() const;
- virtual uint8_t GetDay() const;
- virtual FX_WEEKDAY GetDayOfWeek() const;
- virtual uint16_t GetDayOfYear() const;
- virtual int64_t GetDayOfAD() const;
- virtual uint8_t GetHour() const;
- virtual uint8_t GetMinute() const;
- virtual uint8_t GetSecond() const;
- virtual uint16_t GetMillisecond() const;
- virtual bool AddYears(int32_t iYears);
- virtual bool AddMonths(int32_t iMonths);
- virtual bool AddDays(int32_t iDays);
- virtual bool AddHours(int32_t iHours);
- virtual bool AddMinutes(int32_t iMinutes);
- virtual bool AddSeconds(int32_t iSeconds);
- virtual bool AddMilliseconds(int32_t iMilliseconds);
- friend CFX_DateTime operator+(const CFX_DateTime& dt1,
- const CFX_DateTime& dt2) {
- CFX_DateTime dt;
- dt.FromUnitime(dt1.ToUnitime() + dt2.ToUnitime());
- return dt;
- }
- friend CFX_DateTime operator+(const CFX_DateTime& dt1,
- const FX_DATETIME& dt2) {
- CFX_DateTime dt;
- dt.FromUnitime(dt1.ToUnitime() + ((const CFX_DateTime&)dt2).ToUnitime());
- return dt;
- }
- friend CFX_DateTime operator+(const FX_DATETIME& dt1,
- const CFX_DateTime& dt2) {
- CFX_DateTime dt;
- dt.FromUnitime(((const CFX_DateTime&)dt1).ToUnitime() + dt2.ToUnitime());
- return dt;
- }
- friend CFX_DateTime operator-(const CFX_DateTime& dt1,
- const CFX_DateTime& dt2) {
- CFX_DateTime dt;
- dt.FromUnitime(dt1.ToUnitime() - dt2.ToUnitime());
- return dt;
- }
- friend CFX_DateTime operator-(const CFX_DateTime& dt1,
- const FX_DATETIME& dt2) {
- CFX_DateTime dt;
- dt.FromUnitime(dt1.ToUnitime() - ((const CFX_DateTime&)dt2).ToUnitime());
- return dt;
- }
- friend CFX_DateTime operator-(const FX_DATETIME& dt1,
- const CFX_DateTime& dt2) {
- CFX_DateTime dt;
- dt.FromUnitime(((const CFX_DateTime&)dt1).ToUnitime() - dt2.ToUnitime());
- return dt;
- }
- friend bool operator==(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
- return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1),
- static_cast<const FX_DATETIME*>(dt2),
- sizeof(FX_DATETIME)) == 0;
- }
- friend bool operator==(const CFX_DateTime& dt1, const FX_DATETIME& dt2) {
- return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1), &dt2,
- sizeof(FX_DATETIME)) == 0;
- }
- friend bool operator==(const FX_DATETIME& dt1, const CFX_DateTime& dt2) {
- return FXSYS_memcmp(&dt1, static_cast<const FX_DATETIME*>(dt2),
- sizeof(FX_DATETIME)) == 0;
- }
- friend bool operator!=(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
- return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1),
- static_cast<const FX_DATETIME*>(dt2),
- sizeof(FX_DATETIME)) != 0;
- }
- friend bool operator!=(const CFX_DateTime& dt1, const FX_DATETIME& dt2) {
- return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1), &dt2,
- sizeof(FX_DATETIME)) != 0;
- }
- friend bool operator!=(const FX_DATETIME& dt1, const CFX_DateTime& dt2) {
- return FXSYS_memcmp(&dt1, static_cast<const FX_DATETIME*>(dt2),
- sizeof(FX_DATETIME)) != 0;
- }
- friend bool operator>(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
- return dt1.ToUnitime() > dt2.ToUnitime();
- }
- friend bool operator>(const CFX_DateTime& dt1, const FX_DATETIME& dt2) {
- return dt1.ToUnitime() > ((const CFX_DateTime&)dt2).ToUnitime();
- }
- friend bool operator>(const FX_DATETIME& dt1, const CFX_DateTime& dt2) {
- return ((const CFX_DateTime&)dt1).ToUnitime() > dt2.ToUnitime();
- }
- friend bool operator>=(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
- return dt1.ToUnitime() >= dt2.ToUnitime();
- }
- friend bool operator>=(const CFX_DateTime& dt1, const FX_DATETIME& dt2) {
- return dt1.ToUnitime() >= ((const CFX_DateTime&)dt2).ToUnitime();
- }
- friend bool operator>=(const FX_DATETIME& dt1, const CFX_DateTime& dt2) {
- return ((const CFX_DateTime&)dt1).ToUnitime() >= dt2.ToUnitime();
- }
- friend bool operator<(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
- return dt1.ToUnitime() < dt2.ToUnitime();
- }
- friend bool operator<(const CFX_DateTime& dt1, const FX_DATETIME& dt2) {
- return dt1.ToUnitime() < ((const CFX_DateTime&)dt2).ToUnitime();
- }
- friend bool operator<(const FX_DATETIME& dt1, const CFX_DateTime& dt2) {
- return ((const CFX_DateTime&)dt1).ToUnitime() < dt2.ToUnitime();
- }
- friend bool operator<=(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
- return dt1.ToUnitime() <= dt2.ToUnitime();
- }
- friend bool operator<=(const CFX_DateTime& dt1, const FX_DATETIME& dt2) {
- return dt1.ToUnitime() <= ((const CFX_DateTime&)dt2).ToUnitime();
- }
- friend bool operator<=(const FX_DATETIME& dt1, const CFX_DateTime& dt2) {
- return ((const CFX_DateTime&)dt1).ToUnitime() <= dt2.ToUnitime();
- }
+ ~CFX_DateTime() {}
+
+ bool Set(int32_t year, uint8_t month, uint8_t day);
+ int32_t GetDayOfWeek() const;
private:
+#if _FX_OS_ != _FX_ANDROID_
+#pragma pack(push, 1)
+#endif
+ struct FX_DATE {
+ int32_t year;
+ uint8_t month;
+ uint8_t day;
+ };
+
+ struct FX_TIME {
+ uint8_t hour;
+ uint8_t minute;
+ uint8_t second;
+ uint16_t millisecond;
+ };
+
+ struct FX_DATETIME {
+ union {
+ FX_DATE sDate;
+ FX_DATE aDate;
+ } Date;
+ union {
+ FX_TIME sTime;
+ FX_TIME aTime;
+ } Time;
+ };
+
+#if _FX_OS_ != _FX_ANDROID_
+#pragma pack(pop)
+#endif
FX_DATETIME m_DateTime;
};
diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp
index db0a25549a..253e8512e1 100644
--- a/xfa/fgas/localization/fgas_locale.cpp
+++ b/xfa/fgas/localization/fgas_locale.cpp
@@ -390,11 +390,11 @@ bool ParseLocaleDate(const CFX_WideString& wsDate,
cc += 2;
}
}
- if (cc < len) {
+ if (cc < len)
return false;
- }
+
CFX_Unitime ut;
- ut.Set(year, month, day);
+ ut.Set(year, month, day, 0, 0, 0, 0);
datetime = datetime + ut;
return !!cc;
}
@@ -1027,7 +1027,7 @@ bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_Unitime& datetime) {
}
}
CFX_Unitime ut;
- ut.Set(year, month, day);
+ ut.Set(year, month, day, 0, 0, 0, 0);
datetime = datetime + ut;
return true;
}
@@ -1035,9 +1035,9 @@ bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_Unitime& datetime) {
bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime,
CFX_Unitime& datetime,
IFX_Locale* pLocale) {
- if (wsTime.GetLength() == 0) {
+ if (wsTime.GetLength() == 0)
return false;
- }
+
uint8_t hour = 0;
uint8_t minute = 0;
uint8_t second = 0;
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
index 094839f486..50685c7e40 100644
--- a/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -522,9 +522,8 @@ bool CXFA_FFDateTimeEdit::LoadWidget() {
if (!wsText.IsEmpty()) {
CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
CFX_Unitime date = lcValue.GetDate();
- if ((FX_UNITIME)date != 0) {
+ if (date.ToInt64() != 0)
pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
- }
}
} break;
default:
@@ -620,7 +619,7 @@ bool CXFA_FFDateTimeEdit::UpdateFWLData() {
CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
CFX_Unitime date = lcValue.GetDate();
if (lcValue.IsValid()) {
- if ((FX_UNITIME)date != 0) {
+ if (date.ToInt64() != 0) {
((CFWL_DateTimePicker*)m_pNormalWidget)
->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
}
@@ -648,7 +647,7 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget,
m_pDataAcc->GetPictureContent(wsPicture, XFA_VALUEPICTURE_Edit);
CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocalMgr());
CFX_Unitime dt;
- dt.Set(iYear, iMonth, iDay);
+ dt.Set(iYear, iMonth, iDay, 0, 0, 0, 0);
date.SetDate(dt);
CFX_WideString wsDate;
date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(),
diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp
index 1012896089..cddfff3134 100644
--- a/xfa/fxfa/parser/xfa_localevalue.cpp
+++ b/xfa/fxfa/parser/xfa_localevalue.cpp
@@ -672,7 +672,8 @@ bool CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate,
return false;
}
CFX_Unitime ut;
- ut.Set(wYear, static_cast<uint8_t>(wMonth), static_cast<uint8_t>(wDay));
+ ut.Set(wYear, static_cast<uint8_t>(wMonth), static_cast<uint8_t>(wDay), 0, 0,
+ 0, 0);
unDate = unDate + ut;
return true;
}