nim-schedules icon indicating copy to clipboard operation
nim-schedules copied to clipboard

Milliseconds support

Open qb-0 opened this issue 2 years ago • 4 comments

import schedules, times, os

schedules:
  every(milliseconds=20, id="tick", throttle=30):
    echo("tick ", now())
    sleep(5000)

Fails currently with [DivByZeroDefect]

qb-0 avatar Sep 23 '21 18:09 qb-0

My bad. Param seconds is still required. Works fine.

qb-0 avatar Sep 23 '21 18:09 qb-0

import schedules, times, os

schedules:
  every(seconds=0, milliseconds=5, id="tick", throttle=30):
    echo("tick ", now())
    sleep(5000)

Seems that it randomly compiles and randomly fails with DivByZeroDefect

qb-0 avatar Sep 23 '21 18:09 qb-0

@qb-0 Currently, nim-schedules uses Second as the minimal resolution (fromUnix). I guess we can update the library by using fromUnixFloat, which supports subsecond as resolution.

soasme avatar Sep 24 '21 22:09 soasme

In my experience, the smallest possible interval is 2 seconds. Anything below that will still result in an interval of "every 2 seconds".

theAkito avatar Oct 23 '22 17:10 theAkito