|
@@ -35,35 +35,35 @@
|
|
|
}
|
|
|
|
|
|
/* static */ SQInteger ScriptDate::GetMonth(ScriptDate::Date date)
|
|
|
{
|
|
|
if (date < 0) return DATE_INVALID;
|
|
|
|
|
|
::TimerGameCalendar::YearMonthDay ymd;
|
|
|
::TimerGameCalendar::ConvertDateToYMD(date, &ymd);
|
|
|
return ymd.month + 1;
|
|
|
}
|
|
|
|
|
|
/* static */ SQInteger ScriptDate::GetDayOfMonth(ScriptDate::Date date)
|
|
|
{
|
|
|
if (date < 0) return DATE_INVALID;
|
|
|
|
|
|
::TimerGameCalendar::YearMonthDay ymd;
|
|
|
::TimerGameCalendar::ConvertDateToYMD(date, &ymd);
|
|
|
return ymd.day;
|
|
|
}
|
|
|
|
|
|
/* static */ ScriptDate::Date ScriptDate::GetDate(SQInteger year, SQInteger month, SQInteger day_of_month)
|
|
|
{
|
|
|
if (month < 1 || month > 12) return DATE_INVALID;
|
|
|
if (day_of_month < 1 || day_of_month > 31) return DATE_INVALID;
|
|
|
if (year < 0 || year > MAX_YEAR) return DATE_INVALID;
|
|
|
if (year < 0 || year > CalendarTime::MAX_YEAR) return DATE_INVALID;
|
|
|
|
|
|
return (ScriptDate::Date)(int32_t)::TimerGameCalendar::ConvertYMDToDate(year, month - 1, day_of_month);
|
|
|
}
|
|
|
|
|
|
/* static */ SQInteger ScriptDate::GetSystemTime()
|
|
|
{
|
|
|
time_t t;
|
|
|
time(&t);
|
|
|
return t;
|
|
|
}
|