Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core:sys/linux - implement clock_settime, clock_getres and clock_nanosleep #4106

Merged
merged 2 commits into from
Aug 21, 2024

Conversation

yeongjukang
Copy link
Contributor

@yeongjukang yeongjukang commented Aug 19, 2024

Hi, I implemented clock_settime, clock_getres and clock_nanosleep.
Below codeblock is my test for the procedures and seem to work.
cc. @flysand7

package main

import "core:fmt"
import "core:sys/linux"

main :: proc() {
    realtime := linux.Clock_Id.REALTIME
    r1, e1 := linux.clock_gettime(realtime)
    fmt.println("clock_gettime result:", r1)
    fmt.println("e1:", e1)

    r2 := &r1
    e2 := linux.clock_settime(realtime, r2)
    fmt.println("clock_settime result:", r2)
    fmt.println("e2:", e2)

    fmt.println("clock_nanosleep - Sleeping for 1s 5ns")
    req := linux.Time_Spec{ uint(1), uint(5)}
    rem := linux.Time_Spec{}
    e3 := linux.clock_nanosleep(realtime, { linux.ITimer_Flags_Bits.ABSTIME } , &req, &rem)
    fmt.println("e3:", e3)
    
    r4, e4 := linux.clock_getres(realtime)
    fmt.println("clock_getres result:", r4)
    fmt.println("e4:", e4)
}

core/sys/linux/sys.odin Outdated Show resolved Hide resolved
@yeongjukang
Copy link
Contributor Author

Thank you for the review @laytan.
I Updated it.

@gingerBill gingerBill merged commit e7b8e61 into odin-lang:master Aug 21, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants