|
@@ -327,26 +327,12 @@ Type TScheduledThreadPoolExecutor Extends TThreadPoolExecutor
|
|
|
bbdoc: Schedules a recurring command to run after a given initial delay, and subsequently with the given period.
|
|
|
End Rem
|
|
|
Method schedule(command:TRunnable, initialDelay:ULong, period:ULong, unit:ETimeUnit = ETimeUnit.Milliseconds)
|
|
|
- Local now:ULong = CurrentUnixTime()
|
|
|
+ Local now:ULong = CurrentUnixTime()
|
|
|
|
|
|
Local newTask:TScheduledTask = New TScheduledTask
|
|
|
|
|
|
- Local delayMs:ULong = initialDelay
|
|
|
- Local periodMs:ULong = period
|
|
|
- Select unit
|
|
|
- Case ETimeUnit.Seconds
|
|
|
- delayMs :* 1000
|
|
|
- periodMs :* 1000
|
|
|
- Case ETimeUnit.Minutes
|
|
|
- delayMs :* 60000
|
|
|
- periodMs :* 60000
|
|
|
- Case ETimeUnit.Hours
|
|
|
- delayMs :* 3600000
|
|
|
- periodMs :* 3600000
|
|
|
- Case ETimeUnit.Days
|
|
|
- delayMs :* 86400000
|
|
|
- periodMs :* 86400000
|
|
|
- End Select
|
|
|
+ Local delayMs:ULong = TimeUnitToMillis(initialDelay, unit)
|
|
|
+ Local periodMs:ULong = TimeUnitToMillis(period, unit)
|
|
|
|
|
|
newTask.executeAt = now + delayMs
|
|
|
newTask.intervalMs = periodMs
|