SA-MP Forums Archive
Converting gettime(); to minutes and seconds - 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: Converting gettime(); to minutes and seconds (/showthread.php?tid=487400)



Converting gettime(); to minutes and seconds - SomebodyAndMe - 13.01.2014

Hello,

As I'm not really a fan of math, I forgot about the formula to calculate this.
Could anyone be so kind to help me?


Kind regards,

Kevin Houghton


Re: Converting gettime(); to minutes and seconds - Voxel - 13.01.2014

Uhm simply do this:
pawn Код:
new Hour, Minute, Second;
gettime(Hour, Minute, Second);
printf("%02d:%02d:%02d", Hour, Minute, Second);
 
new Seconds = gettime();
printf("Seconds since midnight 1st January 1970: %d", Seconds);
from: https://sampwiki.blast.hk/wiki/Gettime

or be more specific on what you want, good luck !


Re: Converting gettime(); to minutes and seconds - SomebodyAndMe - 13.01.2014

I want to calculate how long it took to go from point A to point be, I've set a gettime(); at the start of point A, now when the player reaches point B, I need to calculate how long the player took to get from A to B with gettime();

Sorry I wasn't specific enough before.