mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-02 21:00:56 +00:00
24 lines
572 B
Plaintext
24 lines
572 B
Plaintext
import std ffi.struct
|
|
|
|
export let timeval = ffiStructDefine(
|
|
"long", "seconds",
|
|
"unsigned int", "microseconds"
|
|
)
|
|
|
|
export let timezone = ffiStructDefine(
|
|
"int", "minutes_greenwich",
|
|
"int", "dst_time"
|
|
)
|
|
|
|
func gettimeofday(value, tz)
|
|
native ffi "c" "int gettimeofday(struct timeval*, struct timezone*)"
|
|
|
|
export func main() {
|
|
let time = ffiStructAllocate(timeval)
|
|
let zone = ffiStructAllocate(timezone)
|
|
let result = gettimeofday(time, zone)
|
|
let seconds = ffiStructValue(timeval, "seconds", time)
|
|
println("Result:", result)
|
|
println("Seconds:", seconds)
|
|
}
|