Closed uggla closed 2 years ago
Ok I think I get it:
/// Obtain the system's UTC offset.
#[cfg(any(target_os = "linux", target_os = "freebsd", unsound_local_offset))]
pub(super) fn local_offset_at(datetime: OffsetDateTime) -> Option<UtcOffset> {
// Ensure that the process is single-threaded unless the user has explicitly opted out of this
// check. This is to prevent issues with the environment being mutated by a different thread in
// the process while execution of this function is taking place, which can cause a segmentation
// fault by dereferencing a dangling pointer.
if !cfg!(unsound_local_offset) && num_threads::is_single_threaded() != Some(true) {
return None;
}
// Safety: We have just confirmed that the process is single-threaded or the user has explicitly
// opted out of soundness.
let tm = unsafe { timestamp_to_tm(datetime.unix_timestamp()) }?;
tm_to_offset(tm)
}
https://time-rs.github.io/internal-api/time/sys/local_offset_at/imp/fn.timestamp_to_tm.html
There's some more information on this issue: https://github.com/borntyping/rust-simple_logger/issues/43
Released v1.16.0 with options to use UTC timestamps. Thanks!
UTC timestamps are now the default in simple_logger 2.0.0.
Hello Sam,
I have the following message compiling my program. I try to activate the threads feature, but I still get the error message below. Of course, if I disable the timestamp feature, it works. Could you advise how to fix this issue as it appears unclear to me ?