I would expect the current time to be set when a new frame begins.
This doesn't matter in multi-threaded mode, as a new frame begins immediately after the previous ends.
But I think it may cause unnecessary animation jitter in single thread mode. Probably less visible if all threads have constant frame time. It's really hard to think about this "CurrentTime" which is not current, but in the past; but it's always in the past, so it kinda works out.
Code that is updating the clock at the end:
|
using (Monitor?.BeginCollecting(PerformanceCollectionType.Work)) |
|
OnNewFrame?.Invoke(); |
|
|
|
using (Monitor?.BeginCollecting(PerformanceCollectionType.Sleep)) |
|
Clock.ProcessFrame(); |
I would expect the current time to be set when a new frame begins.
This doesn't matter in multi-threaded mode, as a new frame begins immediately after the previous ends.
But I think it may cause unnecessary animation jitter in single thread mode. Probably less visible if all threads have constant frame time. It's really hard to think about this "CurrentTime" which is not current, but in the past; but it's always in the past, so it kinda works out.
Code that is updating the clock at the end:
osu-framework/osu.Framework/Threading/GameThread.cs
Lines 457 to 461 in 3dbcf01