Getting exact time

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Mucho

Cyber User
Mar 25, 2005
33
0
0
41
Honolulu
Does someone know how to get server time (time in milliseconds) in Unreal script ?
I'm thinking about doing a native c++ function who return system time but maybe something already exist.

( For the moment I'm using an integer variable TimeElapsed in the Timer function, who have do be executed only every second. )
 

elmuerte

Master of Science
Jan 25, 2000
1,936
0
36
42
the Netherlands
elmuerte.com
Level.TimeSeconds gives the time in seconds since the game began, however, it's not safe. It's influenced by the Level.TimeDilation variable. In other words, it's the game time, not the real world time.

For the real world time you can use the following variables defined in LevelInfo:
Code:
var transient int   Year;          // Year.
var transient int   Month;         // Month.
var transient int   Day;           // Day of month.
var transient int   DayOfWeek;     // Day of week.
var transient int   Hour;          // Hour.
var transient int   Minute;        // Minute.
var transient int   Second;        // Second.
var transient int   Millisecond;   // Millisecond.