Fix negative dates, and time moving in opposite direction

This commit is contained in:
smoogipoo 2018-12-19 13:07:43 +09:00 committed by Dean Herbert
parent 86ce0b5519
commit d28c754256
1 changed files with 3 additions and 3 deletions

View File

@ -54,14 +54,14 @@ private void updateTimeWithReschedule()
var diffToNow = DateTimeOffset.Now.Subtract(Date);
double timeUntilNextUpdate = 1000;
if (diffToNow.TotalSeconds > 60)
if (Math.Abs(diffToNow.TotalSeconds) > 120)
{
timeUntilNextUpdate *= 60;
if (diffToNow.TotalMinutes > 60)
if (Math.Abs(diffToNow.TotalMinutes) > 120)
{
timeUntilNextUpdate *= 60;
if (diffToNow.TotalHours > 24)
if (Math.Abs(diffToNow.TotalHours) > 48)
timeUntilNextUpdate *= 24;
}
}