Skip to content

Commit 7fbc4e9

Browse files
authored
Merge pull request #1648 from reitermarkus/newlib-clock
Add Newlib clock constants and functions.
2 parents e15be47 + b1d6c66 commit 7fbc4e9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/unix/newlib/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,10 @@ pub const AF_UNSPEC: ::c_int = 0;
417417
pub const AF_INET: ::c_int = 2;
418418
pub const AF_INET6: ::c_int = 23;
419419

420+
pub const CLOCK_REALTIME: ::clockid_t = 1;
421+
pub const CLOCK_MONOTONIC: ::clockid_t = 4;
422+
pub const CLOCK_BOOTTIME: ::clockid_t = 4;
423+
420424
pub const SOCK_STREAM: ::c_int = 1;
421425
pub const SOCK_DGRAM: ::c_int = 2;
422426

@@ -597,6 +601,18 @@ extern "C" {
597601

598602
pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t)
599603
-> ::c_int;
604+
pub fn clock_settime(
605+
clock_id: ::clockid_t,
606+
tp: *const ::timespec,
607+
) -> ::c_int;
608+
pub fn clock_gettime(
609+
clock_id: ::clockid_t,
610+
tp: *mut ::timespec,
611+
) -> ::c_int;
612+
pub fn clock_getres(
613+
clock_id: ::clockid_t,
614+
res: *mut ::timespec,
615+
) -> ::c_int;
600616
pub fn closesocket(sockfd: ::c_int) -> ::c_int;
601617
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
602618
pub fn recvfrom(

0 commit comments

Comments
 (0)