Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no localtime on openbsd #630

Closed
brahin2 opened this issue Oct 18, 2023 · 7 comments
Closed

no localtime on openbsd #630

brahin2 opened this issue Oct 18, 2023 · 7 comments
Labels
A-local-offset Area: local offset C-upstream Category: nothing actionable in the time crate

Comments

@brahin2
Copy link

brahin2 commented Oct 18, 2023

as seen in tokio-rs/tracing#2764 and Drakulix/simplelog.rs#138 time does not properly return localtime on any version of openbsd. at best it returns nothing, at worst it crashes the app using the crate.

@jhpratt
Copy link
Member

jhpratt commented Oct 18, 2023

Given that one of the issues you linked is for tracing, is your program multi-threaded at the time of invocation? If so, that is why the call is failing. If it crashes the program, please post a stack trace.

@jhpratt jhpratt added C-needs-details Category: more details are needed to assess the situation A-local-offset Area: local offset labels Oct 18, 2023
@brahin2
Copy link
Author

brahin2 commented Oct 18, 2023

not multithreaded. i posted over there but they said to bring the issue here.

@jhpratt
Copy link
Member

jhpratt commented Oct 18, 2023

Can you please provide some more information? At the moment, I have next to nothing to go off of.

@brahin2
Copy link
Author

brahin2 commented Oct 18, 2023

let me know what you need and will try. there really isnt much i can see to go off of either.
using the example from https://time-rs.github.io/book/#getting-started here is what i get:

~/time-demo % cat Cargo.toml
[package]
name = "time-demo"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
time = { version = "0.3", features = ["macros", "local-offset"] }

~/time-demo % cat src/main.rs
use time::OffsetDateTime;

fn main() {
    println!("Hello, world!");

    let now_utc = OffsetDateTime::now_utc();
    dbg!(&now_utc);

    let now_local = OffsetDateTime::now_local();
    dbg!(&now_local);
}

~/time-demo % cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/debug/time-demo`
Hello, world!
[src/main.rs:7] &now_utc = 2023-10-18 0:57:52.375686939 +00:00:00
[src/main.rs:10] &now_local = Err(
    IndeterminateOffset,
)

@jhpratt
Copy link
Member

jhpratt commented Oct 18, 2023

After looking at the possible scenarios where this could return the error variant, the reason is that no one has implemented a way to check the number of running threads (for the current process) for OpsnBSD. This information is required for soundness.

@brahin2
Copy link
Author

brahin2 commented Oct 19, 2023

i wouldn't know where to find that to help out. hopefully someone can soon since this breaks a bunch of crates on openbsd. at the very least a note somewhere of what platforms arent supported and maybe why would help. like what would even be needed in libc for example if approrpiate.

@jhpratt jhpratt added C-upstream Category: nothing actionable in the time crate and removed C-needs-details Category: more details are needed to assess the situation labels Nov 11, 2023
@jhpratt
Copy link
Member

jhpratt commented Apr 2, 2024

Closing in favor of jhpratt/num_threads#21, which is where the issue would actually be resolved.

@jhpratt jhpratt closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-local-offset Area: local offset C-upstream Category: nothing actionable in the time crate
Projects
None yet
Development

No branches or pull requests

2 participants