runtime: add support for time.Now()

TODO: On unix systems, this does not return an accurate value.
This commit is contained in:
Ayke van Laethem
2018-10-15 20:20:37 +02:00
parent ccee42ec7a
commit a613d0484e
+8
View File
@@ -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
}