mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 02:33:28 +00:00
runtime: add support for time.Now()
TODO: On unix systems, this does not return an accurate value.
This commit is contained in:
@@ -98,3 +98,11 @@ func sliceCopy(dst, src unsafe.Pointer, dstLen, srcLen lenType, elemSize uintptr
|
|||||||
func sleep(d int64) {
|
func sleep(d int64) {
|
||||||
sleepTicks(timeUnit(d / tickMicros))
|
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
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user