Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/runtime/runtime_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be implemented much simpler: int is 32-bit on 32-bit systems and 64-bit on 64-bit systems. This matches gc and I see no reason to change that behavior.
This is different from C because Go is not tied to C legacy where int is usually 32-bit even on 64-bit platforms and you can't rely on any particular behavior.

}

const CLOCK_MONOTONIC_RAW = 4
Expand Down
6 changes: 6 additions & 0 deletions src/runtime/runtime_unix32.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// +build !baremetal
// +build arm

package runtime

type timeT int32
6 changes: 6 additions & 0 deletions src/runtime/runtime_unix64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// +build !baremetal
// +build arm64 amd64 i386

package runtime

type timeT int64