Adding TimeSpan to DateTime isn't working

Hi,

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.

Screenshot:

Thank you

However the DateTime is not
updating… I might be missing
something simple here…

Regarding date time, see if this helps:

The DateTime variable is set correctly year 2020, month 1 and day 1. The TimeSpan shouldn’t need to have 1’s in place of the 0’s.

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++.

Yeah, it looks fine at a glance. So what is it actually complaining about?

For anyone having the same issue… After taking a break from it and coming back, I almost instantly realised how stupid I was being…

 FTimespan modifyTime;
 modifyTime.FromSeconds(seconds);

FTimespan.FromSeconds() returns a new FTimespan…

So the correct code is…

// Create and initialise the variable on a single line calling the method correctly...
FTimespan modifyTime = FTimespan::FromSeconds(seconds);

Thank you to those who helped