mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 21:21:33 +00:00
17 lines
543 B
Plaintext
17 lines
543 B
Plaintext
import std ffi.struct
|
|
|
|
export type timeval = native ffi "long" "seconds" "unsigned int" "microseconds"
|
|
export type timezone = native ffi "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)
|
|
}
|