Beispiel
golang.org/x/sys v0.40.0: unix.NsecToTimeval
Verifiziertes Beispiel für golang golang.org/x/sys v0.40.0: unix.NsecToTimeval. Der Vertrag lief auf go 1.26 · linux debian/x64 · docker und bestand.
sha256:8325184896d3a233288d9e0ed29ad74488e1bf7110fbf0777345f1a55aa84197
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
linux 24 · ubuntu · glibc 2.39 x64 go
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| go 1.26 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a… |
2026-10-11 |
Fall
HOW- Ziel
- verify golang.org/x/sys/unix.NsecToTimeval in pkg:golang/golang.org/x/sys@v0.40.0
- Pakete
- Symbole
-
- golang.org/x/sys/unix.NsecToTimeval
- Erstellt
- 2026-10-11T13:46:30Z
Contract
- unix.NsecToTimeval converts nanoseconds into a unix.Timeval struct with Sec and Usec fields
- unix.NsecToTimeval handles zero nanoseconds resulting in zero Sec and Usec
- unix.NsecToTimeval accurately splits subsecond and multi-second time intervals into seconds and microseconds
Dateien
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
Quelltext
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify golang.org/x/sys/unix.NsecToTimeval in pkg:golang/golang.org/x/sys@v0.40.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/golang.org/x/sys@v0.40.0
Demonstrate these symbols/APIs:
- golang.org/x/sys/unix.NsecToTimeval
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:727ede13fe56c8e9b5cb1ed7bdff58dccb74ee9acaeeb5ec9a0f5054cb55d226","contract":["unix.NsecToTimeval converts nanoseconds into a unix.Timeval struct with Sec and Usec fields","unix.NsecToTimeval handles zero nanoseconds resulting in zero Sec and Usec","unix.NsecToTimeval accurately splits subsecond and multi-second time intervals into seconds and microseconds"],"goal":"verify golang.org/x/sys/unix.NsecToTimeval in pkg:golang/golang.org/x/sys@v0.40.0","kind":"HOW","packages":["pkg:golang/golang.org/x/sys@v0.40.0"],"schemaVersion":1,"symbols":["golang.org/x/sys/unix.NsecToTimeval"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/golang.org/x/sys@v0.40.0"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/sys@v0.40.0","symbols":["golang.org/x/sys/unix.NsecToTimeval"],"verifierAdapter":"golang@1"}
module example.com/sample
go 1.24.0
require golang.org/x/sys v0.40.0
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
package main
import (
"fmt"
"golang.org/x/sys/unix"
)
// NanosecondsToTimeval converts an integer nanosecond count into a unix.Timeval.
func NanosecondsToTimeval(nsec int64) unix.Timeval {
return unix.NsecToTimeval(nsec)
}
func main() {
nanoseconds := int64(2500000000) // 2.5 seconds
tv := NanosecondsToTimeval(nanoseconds)
fmt.Printf("Nanoseconds: %d -> Timeval: {Sec: %d, Usec: %d}\n", nanoseconds, tv.Sec, tv.Usec)
}
{
"schemaVersion": 1,
"goal": "verify golang.org/x/sys/unix.NsecToTimeval in pkg:golang/golang.org/x/sys@v0.40.0",
"kind": "HOW",
"packages": [
"pkg:golang/golang.org/x/sys@v0.40.0"
],
"symbols": [
"golang.org/x/sys/unix.NsecToTimeval"
]
}
package main
import (
"fmt"
"os"
"golang.org/x/sys/unix"
)
func main() {
// Assertion 1: unix.NsecToTimeval converts nanoseconds into a unix.Timeval struct with Sec and Usec fields
nsec1 := int64(2500000000)
tv1 := unix.NsecToTimeval(nsec1)
if tv1.Sec != 2 || tv1.Usec != 500000 {
fmt.Fprintf(os.Stderr, "FAIL: expected Sec=2, Usec=500000, got Sec=%d, Usec=%d\n", tv1.Sec, tv1.Usec)
os.Exit(1)
}
// Assertion 2: unix.NsecToTimeval handles zero nanoseconds resulting in zero Sec and Usec
tvZero := unix.NsecToTimeval(0)
if tvZero.Sec != 0 || tvZero.Usec != 0 {
fmt.Fprintf(os.Stderr, "FAIL: expected zero timeval, got %+v\n", tvZero)
os.Exit(1)
}
// Assertion 3: unix.NsecToTimeval accurately splits subsecond and multi-second time intervals into seconds and microseconds
tvSub := unix.NsecToTimeval(123456000)
if tvSub.Sec != 0 || tvSub.Usec != 123456 {
fmt.Fprintf(os.Stderr, "FAIL: expected Sec=0, Usec=123456, got %+v\n", tvSub)
os.Exit(1)
}
tvMulti := unix.NsecToTimeval(10999999000)
if tvMulti.Sec != 10 || tvMulti.Usec != 999999 {
fmt.Fprintf(os.Stderr, "FAIL: expected Sec=10, Usec=999999, got %+v\n", tvMulti)
os.Exit(1)
}
fmt.Println("PASS: unix.NsecToTimeval contract verified successfully")
}
Ursprungs-Seeder
anonym