Skip to content

Commit

Permalink
reworking time apis a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
elcritch committed Oct 28, 2020
1 parent d87c52d commit 671612c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/nesper/timers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ proc delayMicros*(us: uint64): uint64 =
while(curr < target):
curr = microsRaw()

return curr
return target-curr

proc delay*(ts: Millis) = discard delayMillis(ts.uint64)
proc delay*(ts: Micros) = discard delayMicros(ts.uint64)
Expand Down
5 changes: 4 additions & 1 deletion tests/tgeneral.nim
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ echo ""

var portTICK_PERIOD_MS* {.importc: "portTICK_PERIOD_MS", header: "<freertos/FreeRTOS.h>".}: cint

delayMillis(100)
discard delayMillis(100)
delay(Millis(100))
discard delayMicros(100)
delay(Micros(100))
esp_restart()

# vTaskDelete*( handle: any )
Expand Down

0 comments on commit 671612c

Please sign in to comment.