Files
AR-Menu/Library/PackageCache/com.needle.engine-exporter@8c046140a1d9/Common/Runtime/Utils/TimeHelper.cs
2025-11-30 08:35:03 +02:00

16 lines
459 B
C#

using System;
namespace Needle.Engine.Utils
{
public static class TimeHelper
{
public static TimeSpan CalculateTimeRemaining(DateTime processStarted, float total, float current)
{
var itemsPerSecond = current / (float)(processStarted - DateTime.Now).TotalSeconds;
if (itemsPerSecond <= 0) return TimeSpan.FromSeconds(60);
var secondsRemaining = (total - current) / itemsPerSecond;
return TimeSpan.FromSeconds(secondsRemaining);
}
}
}