mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-29 17:19:50 -06:00
Exclude time spent with emulator paused from play time (ryubing/ryujinx!55)
See merge request ryubing/ryujinx!55
This commit is contained in:
@ -33,19 +33,11 @@ namespace Ryujinx.Ava.Systems.AppLibrary
|
||||
/// <summary>
|
||||
/// Updates <see cref="LastPlayed"/> and <see cref="TimePlayed"/>. Call this after a game ends.
|
||||
/// </summary>
|
||||
public void UpdatePostGame()
|
||||
/// <param name="playTime">The active gameplay time this past session.</param>
|
||||
public void UpdatePostGame(TimeSpan playTime)
|
||||
{
|
||||
DateTime? prevLastPlayed = LastPlayed;
|
||||
UpdatePreGame();
|
||||
|
||||
if (!prevLastPlayed.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TimeSpan diff = DateTime.UtcNow - prevLastPlayed.Value;
|
||||
double newTotalSeconds = TimePlayed.Add(diff).TotalSeconds;
|
||||
TimePlayed = TimeSpan.FromSeconds(Math.Round(newTotalSeconds, MidpointRounding.AwayFromZero));
|
||||
TimePlayed += playTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user