04.05.2011, 23:26
pawn Код:
stock GetDateAndTimeOfMs(millisecond, &year, &month, &day, &hour, &minute, &second)
{
new accuracity;
tickcount(accuracity);
while(millisecond > accuracity-1)
{
millisecond = millisecond-accuracity;
second++;
}
while(second > 59)
{
second = second-60;
minute++;
}
while(minute > 59)
{
minute = minute-60;
hour++;
}
while(hour > 23)
{
hour = hour-24;
day++;
}
while(day > 27)
{
day = day-28;
month++;
}
while(month > 11)
{
month = month-12;
year++;
}
}
pawn Код:
GetDateAndTimeOfMs(milliseconds, &year, &month, &day, &hour, &minute, &second);
pawn Код:
new year, month, day, hour, minute, second;
GetDateAndTimeOfMs(1000000000, year, month, day, hour, minute, second);
printf("Time: %d years | %d months | %d days | %d hours | %d minutes | %d seconds", year, month, day, hour, minute, second);