FDateTime::Now() doesn't work outside of editor

Hello. I have a problem with getting a local time of my computer. So, I have following code:

FDateTime curDateTime;
curDateTime.Now();
int32 hours = curDateTime.GetHour();
int32 minutes = curDateTime.GetMinute();
int32 seconds = curDateTime.GetSecond();
debug("%i:%i:%i", hours, minutes, seconds);

When I’m clicking “Play” button in editor, this code works correctly and always returns actual time. But when I’m trying to execute packaged project (Win64), I’m always getting 0:0:16 when this part of code is calling. What’s wrong? Some ideas?

Hey,

Try the following:

FDateTime curDateTime = FDateTime::Now();

Thats the only way I had it work correctly for me, lmk if that works for you.

Thanks. I already found this solution and use it now.