aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/defs_linux_arm.go
diff options
context:
space:
mode:
authorJorropo <jorropo.pgm@gmail.com>2026-03-04 10:01:11 +0100
committerGopher Robot <gobot@golang.org>2026-04-06 10:01:22 -0700
commitba402cd756a02cd80bcd76a2f7afc22ae2041c6c (patch)
tree7ec950909238e2bfa126fd95e40875ad0699a99c /src/runtime/defs_linux_arm.go
parent6110cd6f83caa1f255189c209711c216d649c6d7 (diff)
downloadgo-ba402cd756a02cd80bcd76a2f7afc22ae2041c6c.tar.xz
runtime: fix timespec definition on 32bits systems
The nsec field of timespec is a C long even when using 64bits time on 32bits systems. This is because by timespec API if nsec never holds more than a second worth of nanoseconds. If it would theses would increment the sec field while the nsec field would get the amount of nanoseconds modulus a second. Fixes #77934 Change-Id: I9803998ba70123eb3b226379bd72b11cae972c38 Reviewed-on: https://go-review.googlesource.com/c/go/+/751341 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime/defs_linux_arm.go')
-rw-r--r--src/runtime/defs_linux_arm.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/runtime/defs_linux_arm.go b/src/runtime/defs_linux_arm.go
index 94577fc597..946f5bb230 100644
--- a/src/runtime/defs_linux_arm.go
+++ b/src/runtime/defs_linux_arm.go
@@ -111,13 +111,14 @@ func (ts *timespec32) setNsec(ns int64) {
type timespec struct {
tv_sec int64
- tv_nsec int64
+ tv_nsec int32
+ _ [4]byte // the C ABI aligns int64 to 8 bytes
}
//go:nosplit
func (ts *timespec) setNsec(ns int64) {
- ts.tv_sec = int64(ns / 1e9)
- ts.tv_nsec = int64(ns % 1e9)
+ ts.tv_sec = ns / 1e9
+ ts.tv_nsec = int32(ns % 1e9)
}
type stackt struct {