mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-18 16:47:42 +01:00
timer.go has a timer struct for scheduling things to happen once every n days before or after a given time. Pass a string list of day deltas to parse, a unit to parse these as (only 24/-24 hours really make sense), then call Check() on the returned struct with your "since" time, and the time a timer was last fired. If one goes off, store the time so you can pass it in subsequent calls. To be used in the user daemon for "remind every N days" functionality. Was initially gonna allow more precision than days, but ran into problems, most likely from me overcomplicating it and not wanting to store too much data. some tests also in timer_test.go.
3.0 KiB
3.0 KiB