Time conversion
#2

I'm not sure. My Div Function is good, use it. It will return you how many times is b in a, without decimal places.

pawn Код:
stock Div(a,b)
{
    new count = 0;
    if(a < b) return 0;
    while((count*b) < a)
    {
        count++;
    }
    count--;
    return count;
}

stock ConvertTime(time)
{
    new String[300];

    new day = Div(time,24*60);
    new hour = Div(time-(24*60*days),60);
    new minute = time - (days*60*24)-(hour*60);

    format(String, sizeof String, "{FF0000}%d {FFFFFF}days, {FF0000}%d {FFFFFF}hours and {FF0000}%d {FFFFFF}minutes", day, hour, minute);
    return String;
}
Reply


Messages In This Thread
Time conversion - by Luis- - 13.03.2013, 19:42
Re: Time conversion - by [MG]Dimi - 13.03.2013, 19:59
Re: Time conversion - by Luis- - 13.03.2013, 20:06
Re: Time conversion - by [MG]Dimi - 13.03.2013, 20:07
Re: Time conversion - by Vince - 13.03.2013, 21:01
Re: Time conversion - by Luis- - 13.03.2013, 21:08
Re: Time conversion - by Vince - 13.03.2013, 21:34

Forum Jump:


Users browsing this thread: 5 Guest(s)