prefer consts to importing #defines from headers
to be completed - better would be to have a libc wrapper that deals with all pesky C ABI details
This commit is contained in:
parent
fe2b39f007
commit
8d7a45f205
6 changed files with 65 additions and 39 deletions
|
|
@ -78,11 +78,16 @@ elif defined(posixRealtime):
|
|||
|
||||
else:
|
||||
# fallback Posix implementation:
|
||||
when defined(linux):
|
||||
type Time = clong
|
||||
else:
|
||||
type Time = int
|
||||
|
||||
type
|
||||
Timeval {.importc: "struct timeval", header: "<sys/select.h>",
|
||||
final, pure.} = object ## struct timeval
|
||||
tv_sec: int ## Seconds.
|
||||
tv_usec: int ## Microseconds.
|
||||
tv_sec: Time ## Seconds.
|
||||
tv_usec: clong ## Microseconds.
|
||||
{.deprecated: [Ttimeval: Timeval].}
|
||||
proc posix_gettimeofday(tp: var Timeval, unused: pointer = nil) {.
|
||||
importc: "gettimeofday", header: "<sys/time.h>".}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue