diff --git a/src/runtime/time.go b/src/runtime/time.go new file mode 100644 index 000000000..1043e3f10 --- /dev/null +++ b/src/runtime/time.go @@ -0,0 +1,20 @@ + +package runtime + +// TODO: use the time package for this. + +// #include +import "C" + +type Duration uint64 + +// Use microseconds as the smallest time unit +const ( + Microsecond = 1 + Millisecond = Microsecond * 1000 + Second = Millisecond * 1000 +) + +func Sleep(d Duration) { + C.usleep(C.useconds_t(d)) +}