minutos = M * 60
horas = H * 60 * 60
dias = D * 24 * 60 * 60
new HORAS = 5;
new Tempo = HORAS * 60 * 60;
Converter(Tempo);
stock Converter(SEGUNDOS)
{
new MINUTOS, HORAS, DIAS;
if(SEGUNDOS > 59)
{
SEGUNDOS = 0;
MINUTOS += 1;
}
if(MINUTOS > 59)
{
MINUTOS = 0;
HORAS += 1;
}
if(HORAS > 23)
{
HORAS = 0;
DIAS += 1;
}
}
Bem tens aqui isto que te ajudara a fazer a conversao:
https://sampforum.blast.hk/showthread.php?tid=347605 |
Cara usar essa include nao vai afetar nada, alem do mais essa da para colocar o GMT o que a maior parte das tais stocks por ai que tu ve nao suporta...
|
stock TB_ConvertTime(Seconds)
{
new Minutes;
if(Seconds > 59)
{
Minutes = Seconds / 60;
Seconds = Seconds - Minutes * 60;
}
new Hours;
if(Minutes > 59)
{
Hours = Minutes / 60;
Minutes = Minutes - Hours * 60;
}
new Days;
if(Hours > 23)
{
Days = Hours / 24;
Hours = Hours - Days * 24;
}
return 1;
}
Nгo vejo necessidade em tentar reinventar a roda, porйm http://pt.stackoverflow.com/question...imestamp/70486
Boa leitura ^^ @Edit como eu disse, nгo hб porque reinventar a roda https://github.com/Crayder/Time-Conv.../timestamp.inc https://sampforum.blast.hk/showthread.php?tid=347605 https://sampforum.blast.hk/showthread.php?tid=294054 |
stock ConvertSeconds(input, &year, &month, &day, &hour, &minute, &second) {
#define MINUTES_IN_HOUR 60
#define HOURS_IN_DAY 24
#define DAYS_IN_WEEK 7
#define DAYS_IN_MONTH 30
#define DAYS_IN_YEAR 365.2425
second = input % SECONDS_PER_MINUTE;
input /= SECONDS_PER_MINUTE;
minute = input % MINUTES_IN_HOUR;
input /= MINUTES_IN_HOUR;
hour = input % HOURS_IN_DAY;
input /= HOURS_IN_DAY;
day = input % DAYS_IN_WEEK;
input /= DAYS_IN_WEEK;
//week = input & WEEKS_IN_MONTH;
month = input / WEEKS_IN_MONTH;
year = floatround(input / DAYS_IN_YEAR, floatround_floor);
}
new year, month, day, hour, minute, second;
// Hora de regresso em 504853 segundos
ConvertSeconds(504853, year, month, day, hour, minute, second);