Why isn't my clock keeping the right time?

Cast() is an unreal cast for unreal objects like UObject or AActor or anything else that uses Unreal’s reflection system. You want to use a C style cast like this (int)totalTime.

You shouldn’t need your clockSecond/Minute/Hour to be anything other than ints, so you don’t need all your temps.

The inGameTime should probably be a float or a double too (float’s probably fine).

Try this:

void UCalendar::AdvanceClock(float DeltaTime){
     inGameTime += gameSecondsPerWorldSecond * DeltaTime;
     int gameTimeSeconds = (int)inGameTime;
     clockSecond = gameTimeSeconds % 60;
     clockMinute = (gameTimeSeconds - clockSecond) % 60;
     clockHour = (gameTimeSeconds - clockSecond - clockMinute * 60) % 24;
 }

and then define your inGameTime as a float and all the clockSecond/Minute/Hour as ints. I’m not sure why it’s 0 without seeing more code. have you tried putting a breakpoint in there to see what it’s doing?