@@ -5,41 +5,41 @@ package timedelay
55import "time"
66
77// WaitFor pauses execution until roughly ms milliseconds have passed.
8- func WaitForTemplate (ms int ) {
8+ func WaitFor (ms int ) {
99 // TODO: compute a target time using time.Now().Add and wait until reached
1010}
1111
1212// NotifyAfter waits for roughly ms milliseconds then sends true on a channel.
13- func NotifyAfterTemplate (ms int ) chan bool {
13+ func NotifyAfter (ms int ) chan bool {
1414 // TODO: start a goroutine that checks time.Now against a target and sends on the channel
1515 return nil
1616}
1717
1818// WaitUntil blocks until the provided target time is reached (or returns if in the past).
19- func WaitUntilTemplate (target time.Time ) {
19+ func WaitUntil (target time.Time ) {
2020 // TODO: loop until time.Now() is not before target
2121}
2222
2323// NotifyAt sends true on a channel when the provided target time is reached.
24- func NotifyAtTemplate (target time.Time ) chan bool {
24+ func NotifyAt (target time.Time ) chan bool {
2525 // TODO: return a channel that will receive true when the target time arrives
2626 return nil
2727}
2828
2929// ElapsedMillis returns how many milliseconds have passed since t.
30- func ElapsedMillisTemplate (t time.Time ) int64 {
30+ func ElapsedMillis (t time.Time ) int64 {
3131 // TODO: use time.Since to compute milliseconds
3232 return 0
3333}
3434
3535// WaitForOrTimeout waits for ms milliseconds but returns an error if waiting exceeds timeoutMs.
36- func WaitForOrTimeoutTemplate (ms int , timeoutMs int ) error {
36+ func WaitForOrTimeout (ms int , timeoutMs int ) error {
3737 // TODO: compute target and deadline with time.Now().Add and return error on timeout
3838 return nil
3939}
4040
4141// ScheduleAfter runs fn after roughly ms milliseconds and returns a channel closed when fn finishes.
42- func ScheduleAfterTemplate (ms int , fn func ()) chan struct {} {
42+ func ScheduleAfter (ms int , fn func ()) chan struct {} {
4343 // TODO: start a goroutine that waits until target, runs fn, then closes the done channel
4444 return nil
4545}
0 commit comments