[Help] Mathematical calculations, to calculate the time in prison.
#2

The easiest way is to convert the return value of gettime(); (in seconds) into seconds, minutes, etc.

pawn Код:
enum tc_method
{
  tc_milliseconds,
  tc_seconds,
  tc_minutes
}

stock TimeConvert(time, &dd=0, &hh=0, &mm=0, &ss=0, &ms=0, tc_method:method=tc_seconds)
{
  if (method == tc_milliseconds)
  {
    ms = time % 1000;
    time = (time - ms)/1000;

    ss = time % 60;
    time = (time - ss)/60;
  }

  else if (method == tc_seconds)
  {
    ss = time % 60;
    time = (time - ss)/60;
  }

  mm = time % 60;
  time = (time - mm)/60;

  hh = time % 24;
  time = (time - hh)/24;

  dd = time;
}
Reply


Messages In This Thread
[Help] Mathematical calculations, to calculate the time in prison. - by vinewood - 02.05.2009, 17:00
Re: [Help] Mathematical calculations, to calculate the time in prison. - by yom - 02.05.2009, 17:43
Re: [Help] Mathematical calculations, to calculate the time in prison. - by JaYmE - 02.05.2009, 17:44

Forum Jump:


Users browsing this thread: 1 Guest(s)