From ad73a727a3620eb487e640a3a6f6ed46276831f2 Mon Sep 17 00:00:00 2001 From: Jaden Weiss Date: Sun, 10 Nov 2019 09:59:26 -0500 Subject: [PATCH] fix time on 32-bit arm on linux --- src/runtime/runtime_unix.go | 6 +++--- src/runtime/runtime_unix32.go | 6 ++++++ src/runtime/runtime_unix64.go | 6 ++++++ 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/runtime/runtime_unix32.go create mode 100644 src/runtime/runtime_unix64.go diff --git a/src/runtime/runtime_unix.go b/src/runtime/runtime_unix.go index 47c7316e7..0e1c26eb0 100644 --- a/src/runtime/runtime_unix.go +++ b/src/runtime/runtime_unix.go @@ -22,7 +22,7 @@ func abort() func exit(code int) //go:export clock_gettime -func clock_gettime(clk_id uint, ts *timespec) +func clock_gettime(clk_id int32, ts *timespec) const heapSize = 1 * 1024 * 1024 // 1MB to start @@ -37,8 +37,8 @@ const tickMicros = 1 // TODO: Linux/amd64-specific type timespec struct { - tv_sec int64 - tv_nsec int64 + tv_sec timeT + tv_nsec timeT } const CLOCK_MONOTONIC_RAW = 4 diff --git a/src/runtime/runtime_unix32.go b/src/runtime/runtime_unix32.go new file mode 100644 index 000000000..507efce1f --- /dev/null +++ b/src/runtime/runtime_unix32.go @@ -0,0 +1,6 @@ +// +build !baremetal +// +build arm + +package runtime + +type timeT int32 diff --git a/src/runtime/runtime_unix64.go b/src/runtime/runtime_unix64.go new file mode 100644 index 000000000..a8902dafa --- /dev/null +++ b/src/runtime/runtime_unix64.go @@ -0,0 +1,6 @@ +// +build !baremetal +// +build arm64 amd64 i386 + +package runtime + +type timeT int64