Skip to content

[unsafe] Add time.h rules#130

Closed
lucic71 wants to merge 5 commits into
Cpp2Rust:masterfrom
lucic71:time
Closed

[unsafe] Add time.h rules#130
lucic71 wants to merge 5 commits into
Cpp2Rust:masterfrom
lucic71:time

Conversation

@lucic71
Copy link
Copy Markdown
Contributor

@lucic71 lucic71 commented May 20, 2026

No description provided.

@lucic71
Copy link
Copy Markdown
Contributor Author

lucic71 commented May 21, 2026

I will close this for now. On maOS, the rule for gettimeofday does not compile because the second argument is different. On Linux the second argument is a struct timezone *, while on macOS this is a void*.

error[E0308]: mismatched types
    --> src/../time/tgt_unsafe.rs:9:28
     |
   9 |     libc::gettimeofday(a0, a1 as *mut ::libc::timezone)
     |     ------------------     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut c_void`, found `*mut timezone`
     |     |
     |     arguments to this function are incorrect
     |
     = note: expected raw pointer `*mut c_void`
                found raw pointer `*mut timezone`
note: function defined here
    --> /Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.186/src/unix/bsd/apple/mod.rs:4352:12
     |
4352 |     pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int;
     |            ^^^^^^^^^^^^

@lucic71 lucic71 closed this May 21, 2026
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.

1 participant