fix broken movie length calculation
this happened to work by chance most of the time, but for movies which cant store the number of milliseconds in an int, it breaks down
This commit is contained in:
parent
97d9ce35e2
commit
f8b3914126
|
@ -45,26 +45,21 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
get
|
||||
{
|
||||
double dblSeconds;
|
||||
double numSeconds;
|
||||
|
||||
if (Header.TryGetValue(HeaderKeys.CycleCount, out var numCyclesStr) && Header.TryGetValue(HeaderKeys.ClockRate, out var clockRateStr))
|
||||
{
|
||||
var numCycles = Convert.ToUInt64(numCyclesStr);
|
||||
var clockRate = Convert.ToDouble(clockRateStr, CultureInfo.InvariantCulture);
|
||||
dblSeconds = numCycles / clockRate;
|
||||
numSeconds = numCycles / clockRate;
|
||||
}
|
||||
else
|
||||
{
|
||||
var numFrames = (ulong)FrameCount;
|
||||
dblSeconds = numFrames / FrameRate;
|
||||
numSeconds = numFrames / FrameRate;
|
||||
}
|
||||
|
||||
var seconds = (int)(dblSeconds % 60);
|
||||
var days = seconds / 86400;
|
||||
var hours = seconds / 3600;
|
||||
var minutes = (seconds / 60) % 60;
|
||||
var milliseconds = (int)((dblSeconds - seconds) * 1000);
|
||||
return new TimeSpan(days, hours, minutes, seconds, milliseconds);
|
||||
return TimeSpan.FromSeconds(numSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue