How to get time in milliseconds/milliseconds timestamp in gdscript?

Godot Version



So, is there no more a way to get a timestamp in milliseconds?

In this thread → How to get milliseconds timestamp in gdscript the last know working method in Godot ?3? was this:


Which was kinda replaced in Godot 4.0 with:


Which is the time in milliseconds since the start of the engine.

The Time class documentation Time — Godot Engine (stable) documentation in English doesn’t mention any other relevant methods.

There is also this related issue on Github (link is splitted since new users can’t post more than 2 links on the first post) HTTPS COLON SLASH SLASH github DOT com PATH /godotengine/godot/issues/19636

I wonder, does anyone know of a way to get the actual OS timestamp in milliseconds in the latest Godot?

Maybe this is what you are looking for:


It returns seconds but the value is a float number, so it should be simple to convert to milliseconds.

Silly me!
At the very end of the documentation, there is written:

Note: Unlike other methods that use integer timestamps, this method returns the timestamp as a float for sub-second precision.

Yes, this is exactly the solution!

To get milliseconds one must therefore simply multiply by 1000:

var current_timestamp = Time.get_unix_time_from_system()
var current_timestamp_in_milliseconds = current_timestamp*1000


Timestamp is:
Milliseconds are:

Hopefully this thread can help other internauts.

Thanks @FencerDevLog !

Marking as solved

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.