I am currently working on an in game clock system but having issues with adding to my FDateTime variable. Here is the code and explanation.
Header
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
FDateTime DateTime;
Code
// inside BeginPlay()
DateTime = FDateTime(2020, 1, 1, 10, 0, 0, 0); // this works correctly
// inside Tick()
double seconds = (double)(60*DeltaTime); // prints correct number
FTimespan modifyTime;
modifyTime.FromSeconds(seconds);
ATestGameModeBase::DateTime += modifyTime;
// If I add a print after, it prints successfully so we are making it past this point. However the DateTime is not updating... I might be missing something simple here...
Edit:
When I try this in blueprint instead, it says the method is DateTime + TimeSpan but does not work.
It isn’t “complaining” in the c++, it just doesn’t work. Everything else prints correctly but the date time after its supposed to be updated.
In blueprint, it just doesn’t allow me to connect the nodes and gives me an error saying it can’t convert TimeSpan to TimeSpan. The blueprint was mostly for testing, I like to keep everything in c++.