[Pawn] [Solved] Get Difference Between Time Period - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) --- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) --- Thread: [Pawn] [Solved] Get Difference Between Time Period (/showthread.php?tid=2031) |
[Solved] Get Difference Between Time Period - Radical - 2021-05-18 I have an function to get difference between time period. But it has a little problem. If start_hour is the current hour and stop_hour is 24am, it does not accurately calculate the difference Between Time. Code: new start_hour, start_minute, start_second, hours, minutes, seconds; function: Code: DifferenceBetweenTimePeriod(start_hour, stop_hour, start_minute, stop_minute, start_second, stop_second, &hours, &minutes, &seconds) { Is there a problem with the function? Solved: This is resolved if I put?24 in?start_hour. Code: DifferenceBetweenTimePeriod(24,?start_hour, start_minute, 0, start_second, 0, hours, minutes, seconds); RE: Get Difference Between Time Period - Markski - 2021-05-18 Hours in a day are counted from 0, there's no hour 24... that's 00. That function should never be receiving 24 as an hour in a normal scenario RE: Get Difference Between Time Period - Radical - 2021-05-18 (2021-05-18, 01:45 AM)Markski Wrote: Hours in a day are counted from 0, there's no hour 24... that's 00. That function should never be receiving 24 as an hour in a normal scenario Yes you are right. But if for example start_hour is 3am and stop_hour is 0am, it returns: 02 Hours 00 Minutes 00 Seconds? It should return? 21 Hours 00 Minutes 00 Seconds RE: [Solved] Get Difference Between Time Period - Y_Less - 2021-05-18 Use unix timestamps. If you ever have a question about time, they are the answer. |