From a613d0484e5de282d82170bd11f0a1151e863659 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Mon, 15 Oct 2018 20:20:37 +0200 Subject: [PATCH] runtime: add support for time.Now() TODO: On unix systems, this does not return an accurate value. --- src/runtime/runtime.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/runtime/runtime.go b/src/runtime/runtime.go index 5b77c1aa..65e89325 100644 --- a/src/runtime/runtime.go +++ b/src/runtime/runtime.go @@ -98,3 +98,11 @@ func sliceCopy(dst, src unsafe.Pointer, dstLen, srcLen lenType, elemSize uintptr func sleep(d int64) { sleepTicks(timeUnit(d / tickMicros)) } + +//go:linkname now time.now +func now() (sec int64, nsec int32, mono int64) { + mono = int64(ticks()) * tickMicros + sec = mono / (1000 * 1000 * 1000) + nsec = int32(mono - sec*(1000*1000*1000)) + return +}