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.
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.
A fast way of getting a timestamp would be to use the haxe.Timer.stamp()
method.
Example:
import haxe.Timer;
var timestamp:Float = Timer.stamp(); // return a timestamp in seconds with fractions
Note that the value itself might differ depending on platforms, only differences between two values make sense.
Sys.time() * 1000.0
- http://api.haxe.org/Sys.html#timeTo 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.