Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current time in milliseconds in Haxe?

I need a function that returns the local time in milliseconds on the CPP target.

I tried Haxe's Date class, but Date.now() gives me the time in seconds.

like image 460
Enes F. Avatar asked Jan 25 '16 20:01

Enes F.


2 Answers

Sys.time() * 1000.0 - http://api.haxe.org/Sys.html#time

Gives the most precise timestamp value (in seconds)

To be clear, I tried this and got millisecond resolution on the cpp target. Sys is available on cpp, cs, java, macro, neko, php and python.

like image 113
Sam Twidale Avatar answered Oct 13 '22 22:10

Sam Twidale


You could try Date.now().getTime(), however:

Returns the timestamp of the date. It might only have a per-second precision depending on the platforms.

like image 27
Andrew Avatar answered Oct 13 '22 20:10

Andrew