feat(Core/Common): add new helpers for time utility (#10207)

This commit is contained in:
Kargatum
2022-01-19 12:01:59 +07:00
committed by GitHub
parent b5ab409614
commit 259b9133f6
60 changed files with 732 additions and 341 deletions

View File

@@ -1849,7 +1849,7 @@ void GameEventMgr::SetHolidayEventTime(GameEventData& event)
tm timeInfo;
if (singleDate)
{
localtime_r(&curTime, &timeInfo);
timeInfo = Acore::Time::TimeBreakdown(curTime);
timeInfo.tm_year -= 1; // First try last year (event active through New Year)
}
else
@@ -1873,8 +1873,7 @@ void GameEventMgr::SetHolidayEventTime(GameEventData& event)
}
else if (singleDate)
{
tm tmCopy;
localtime_r(&curTime, &tmCopy);
tm tmCopy = Acore::Time::TimeBreakdown(curTime);
int year = tmCopy.tm_year; // This year
tmCopy = timeInfo;
tmCopy.tm_year = year;