diff options
author | deadprogram <[email protected]> | 2024-12-02 13:48:52 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2024-12-04 15:53:49 +0100 |
commit | 3eee686932d9b04534ea83bdbed7a7faf6f6b910 (patch) | |
tree | 84b8bf1b800158be569a62dfc5b19a795af2c804 /src/runtime | |
parent | 4aac3cd7b1ca59e339fcb0953e7641b8aac27cd2 (diff) | |
download | tinygo-3eee686932d9b04534ea83bdbed7a7faf6f6b910.tar.gz tinygo-3eee686932d9b04534ea83bdbed7a7faf6f6b910.zip |
fix: allow nintendoswitch target to compile
Signed-off-by: deadprogram <[email protected]>
Diffstat (limited to 'src/runtime')
-rw-r--r-- | src/runtime/nonhosted.go | 2 | ||||
-rw-r--r-- | src/runtime/runtime_nintendoswitch.go | 21 | ||||
-rw-r--r-- | src/runtime/runtime_unix.go | 2 |
3 files changed, 23 insertions, 2 deletions
diff --git a/src/runtime/nonhosted.go b/src/runtime/nonhosted.go index ca5ab4c3c..9f01a7621 100644 --- a/src/runtime/nonhosted.go +++ b/src/runtime/nonhosted.go @@ -1,4 +1,4 @@ -//go:build baremetal || js || wasm_unknown +//go:build baremetal || js || wasm_unknown || nintendoswitch package runtime diff --git a/src/runtime/runtime_nintendoswitch.go b/src/runtime/runtime_nintendoswitch.go index d2567b1cc..2d3677bf0 100644 --- a/src/runtime/runtime_nintendoswitch.go +++ b/src/runtime/runtime_nintendoswitch.go @@ -84,6 +84,19 @@ func ticks() timeUnit { return timeUnit(ticksToNanoseconds(timeUnit(getArmSystemTick()))) } +// timeOffset is how long the monotonic clock started after the Unix epoch. It +// should be a positive integer under normal operation or zero when it has not +// been set. +var timeOffset int64 + +//go:linkname now time.now +func now() (sec int64, nsec int32, mono int64) { + mono = nanotime() + sec = (mono + timeOffset) / (1000 * 1000 * 1000) + nsec = int32((mono + timeOffset) - sec*(1000*1000*1000)) + return +} + var stdoutBuffer = make([]byte, 120) var position = 0 @@ -98,6 +111,14 @@ func putchar(c byte) { position++ } +func buffered() int { + return 0 +} + +func getchar() byte { + return 0 +} + func abort() { for { exit(1) diff --git a/src/runtime/runtime_unix.go b/src/runtime/runtime_unix.go index e6f81778d..08e3e7426 100644 --- a/src/runtime/runtime_unix.go +++ b/src/runtime/runtime_unix.go @@ -1,4 +1,4 @@ -//go:build (darwin || (linux && !baremetal && !wasip1 && !wasm_unknown && !wasip2)) && !nintendoswitch +//go:build darwin || (linux && !baremetal && !wasip1 && !wasm_unknown && !wasip2 && !nintendoswitch) package runtime |