pawn Код:
stock mktime(hour, minute, second, day, month, year)
{
static
days_of_month[12] =
{
31,
29,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31
},
lMinute,
lHour,
lDay,
lMonth,
lYear,
lMinuteS,
lHourS,
lDayS,
lMonthS,
lYearS;
if (year != lYear)
{
lYearS = 0;
for (new j = 1970; j < year; j++)
{
lYearS += 31536000;
if ((!(j % 4) && (j % 100)) || !(j % 400)) lYearS += 86400;
}
lYear = year;
}
if (month != lMonth)
{
lMonthS = 0;
month--;
for (new i = 0; i < month; i++)
{
lMonthS += days_of_month[i] * 86400;
if ((i == 1) && ((!(year % 4) && (year % 100)) || !(year % 400))) lMonthS += 86400;
}
lMonth = month;
}
if (day != lDay)
{
lDayS = day * 86400;
lDay = day;
}
if (hour != lHour)
{
lHourS = hour * 3600;
lHour = hour;
}
if (minute != lMinute)
{
lMinuteS = minute * 60;
lMinute = minute;
}
return lYearS + lMonthS + lDayS + lHourS + lMinuteS + second;
}
stock mktime(hour, minute, second, day, month, year)
{
static
days_of_month[12] =
{
31,
29,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31
},
lMinute,
lHour,
lDay,
lMonth,
lYear,
lMinuteS,
lHourS,
lDayS,
lMonthS,
lYearS;
if (year != lYear)
{
lYearS = 0;
for (new j = 1970; j < year; j++)
{
lYearS += 31536000;
if ((!(j % 4) && (j % 100)) || !(j % 400)) lYearS += 86400;
}
lYear = year;
}
if (month != lMonth)
{
lMonthS = 0;
month--;
for (new i = 0; i < month; i++)
{
lMonthS += days_of_month[i] * 86400;
if ((i == 1) && ((!(year % 4) && (year % 100)) || !(year % 400))) lMonthS += 86400;
}
lMonth = month;
}
if (day != lDay)
{
lDayS = day * 86400;
lDay = day;
}
if (hour != lHour)
{
lHourS = hour * 3600;
lHour = hour;
}
if (minute != lMinute)
{
lMinuteS = minute * 60;
lMinute = minute;
}
return lYearS + lMonthS + lDayS + lHourS + lMinuteS + second;
}