mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
refactor: UpdateRunTime -> GetNextRunTime, add UpdateRunTime for caching GetNextRunTime value
- also swap the operands on the delta time calculation
This commit is contained in:
parent
c25a82399d
commit
a46987aabf
2 changed files with 8 additions and 3 deletions
|
|
@ -27,7 +27,12 @@ namespace ICD.Common.Utils.Services.Scheduler
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
RunFinal();
|
RunFinal();
|
||||||
NextRunTime = UpdateRunTime();
|
NextRunTime = GetNextRunTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateNextRunTime()
|
||||||
|
{
|
||||||
|
NextRunTime = GetNextRunTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -38,6 +43,6 @@ namespace ICD.Common.Utils.Services.Scheduler
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs after RunFinal in order to set the next run time of this action
|
/// Runs after RunFinal in order to set the next run time of this action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract DateTime? UpdateRunTime();
|
public abstract DateTime? GetNextRunTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -137,7 +137,7 @@ namespace ICD.Common.Utils.Services.Scheduler
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long msToNextAction = (long)(DateTime.Now - action.NextRunTime.Value).TotalMilliseconds;
|
long msToNextAction = (long)(action.NextRunTime.Value - DateTime.Now).TotalMilliseconds;
|
||||||
m_Timer.Reset(msToNextAction);
|
m_Timer.Reset(msToNextAction);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue