I've created a PowerShell script to count the amount of game time recorded in your FAForever replays. (Personne#4604) discovered that it didn't work for earlier formats of replays and that has been fixed up.
I'm using PowerShell 7.1.2 but I've successfully tested this in PowerShell 5.1
$replays = Get-ChildItem C:\ProgramData\FAForever\replays\*.fafreplay | Sort-Object LastWriteTime -Descending
#$unixtime = (Get-Date 1/1/1970).AddHours((Get-TimeZone).BaseUtcOffset.TotalHours)
#The replays incorrectly use your local time zone so I don't bother adjusting for it
$unixtime = (Get-Date 1/1/1970)
$playtime =0
foreach ($r in $replays) {
Remove-Variable j -ErrorAction SilentlyContinue
$j = (Get-Content $r.FullName)[0] | ConvertFrom-Json
if ($j.launched_at -gt 0) {
$playtime += (New-TimeSpan ($unixtime.AddSeconds($j.launched_at)) ($unixtime.AddSeconds($j.game_end))).TotalSeconds
} else {
$playtime += (New-TimeSpace ($unixtime.AddSeconds($j.game_time)) ($unixtime.AddSeconds($j.game_end))).TotalSeconds
}
}
$playhours = [Math]::Floor($playtime/60/60)
$playminutes = [Math]::Floor( (($playtime/60/60) - $playhours) * 60)
Write-Output "You've played for $($playhours) $(if ($playhours -ne 1) {"hours"} else {"hour"}) and $(if ($playminutes -ne 1) {"$($playminutes) minutes"} else {"$($playminutes) minute"}) in $($replays.count) replay$(if ($replays.count -ne 1) {"s"})."