Infinite Loop!
#8

Is this stock a problem?:
pawn Код:
stock date(timestamp, &f_day, &f_month, &f_year, &f_hour, &f_min, &f_sec)
{
    new s_year=1970, s_day=0, s_month=0, s_hour=0, s_mins=0;
    new days_of_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    while(timestamp > 31622400)
    {
        timestamp -= 31536000;
        if(((s_year % 4 == 0) && (s_year % 100 != 0)) || (s_year % 400 == 0))  timestamp -= 86400;
        s_year++;
    }

    if(((s_year % 4 == 0) && (s_year % 100 != 0)) || (s_year % 400 == 0))
    {
        days_of_month[1] = 29;
    }
    else
    {
        days_of_month[1] = 28;
    }

    while(timestamp > 86400)
    {
        timestamp -= 86400, s_day++;
        if(s_day == days_of_month[s_month]) s_day=0, s_month++;
    }

    while(timestamp>60)
    {
        timestamp -= 60, s_mins++;
        if(s_mins == 60) s_mins=0, s_hour++;
    }

    f_day = s_day + 1;
    f_month = s_month + 1;
    f_year = s_year;
    f_hour = s_hour;
    f_min = s_mins;
    f_sec = timestamp;

    return true;
}
Reply


Messages In This Thread
Infinite Loop! - by TheBosss - 28.03.2014, 13:13
Re: Infinite Loop! - by Kyle - 28.03.2014, 13:14
Re: Infinite Loop! - by Schocc - 28.03.2014, 13:15
Re: Infinite Loop! - by Vince - 28.03.2014, 13:16
Re: Infinite Loop! - by TheBosss - 28.03.2014, 13:20
Re: Infinite Loop! - by Schocc - 28.03.2014, 13:30
Re: Infinite Loop! - by TheBosss - 28.03.2014, 18:13
Re: Infinite Loop! - by TheBosss - 29.03.2014, 10:53

Forum Jump:


Users browsing this thread: 3 Guest(s)