SA-MP Forums Archive
Need something - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need something (/showthread.php?tid=633870)



Need something - michomkd - 08.05.2017

Hello guys, i need something that will convert time from GetTickCount ( from miliseconds to Hours,Minutes )

All best


Re: Need something - AbyssMorgan - 08.05.2017

PHP код:
//%d:%02d:%02d:%02d days:hours:minutes:seconds
#define SecToTimeDay(%0)                                ((%0) / 86400),(((%0) % 86400) / 3600),((((%0) % 86400) % 3600) / 60),((((%0) % 86400) % 3600) % 60)
#define MSToTimeDay(%0)                                    SecToTimeDay((%0)/1000)
//%02d:%02d:%02d hours:minutes:seconds
#define SecToTime(%0)                                    ((%0) / 3600),(((%0) % 3600) / 60),(((%0) % 3600) % 60)
#define MSToTime(%0)                                    SecToTime((%0)/1000)
//%02d:%02d minutes:seconds
#define SecToTimeMini(%0)                                ((%0) / 60),((%0) % 60)
#define MSToTimeMini(%0)                                SecToTimeMini((%0)/1000) 
PHP код:
printf("GetTickCount: %02d:%02d:%02d",MSToTime(GetTickCount()));