Forum > macOS / Mac OS X
How to get time in miliseconds?
(1/1)
Igor Kokarev:
How to get time in miliseconds on Mac? With 1 ms accuracy.
On Windows I call TimeGetTime() with TimeBeginPeriod(1) / TimeEndPeriod(1).
dbannon:
cross platform, do you want to time something or really get the actual time ?
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var Tick, Tock : qword; Tick := gettickcount64();Something()Tock := gettickcount64();debugln('Something took '+ inttostr(Tock-Tick) + 'mS');
If you want the real time, call now(), there are a number of functions that will turn a TDateTime into what ever format you want.
Handoko:
Several options are available, read more:
http://forum.lazarus.freepascal.org/index.php/topic,41430.msg287441.html#msg287441
FYI, GetTickCount64 isn't very precise.
Igor Kokarev:
Thanks! I will check these variants.
Navigation
[0] Message Index