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

macOS build from source fails to start: "Could not determine the UTC offset on this system" #42

Closed
arunkv opened this issue Jan 3, 2022 · 2 comments

Comments

@arunkv
Copy link

arunkv commented Jan 3, 2022

Base system

Built on macOS Monterey 12.2 Beta (21D5025f) from master following instructions https://noaa-apt.mbernardi.com.ar/development.html#mac--osx
My system timezone is IST (UTC+0530)

Problem

Launching ./target/release/noaa-apt shows this error:

❯ ./target/release/noaa-apt
thread 'main' panicked at 'Could not determine the UTC offset on this system. Possible causes are that the time crate does not implement "local_offset_at" on your system, or that you are running in a multi-threaded environment and the time crate is returning "None" from "local_offset_at" to avoid unsafe behaviour. See the time crate's documentation for more information. (https://time-rs.github.io/internal-api/time/index.html#feature-flags): IndeterminateOffset', /Users/arun/.cargo/registry/src/github.com-1ecc6299db9ec823/simple_logger-1.16.0/src/lib.rs:409:85
stack backtrace:
0: rust_begin_unwind
at /rustc/404c8471aba60c2d837fa728e7c729a0f52d5830/library/std/src/panicking.rs:498:5
1: core::panicking::panic_fmt
at /rustc/404c8471aba60c2d837fa728e7c729a0f52d5830/library/core/src/panicking.rs:107:14
2: core::result::unwrap_failed
at /rustc/404c8471aba60c2d837fa728e7c729a0f52d5830/library/core/src/result.rs:1661:5
3: <simple_logger::SimpleLogger as log::Log>::log
4: log::__private_api_log
5: noaa_apt::gui::gui::create_window
6: ::connect_startup::startup_trampoline
7: _g_closure_invoke
8: _signal_emit_unlocked_R
9: _g_signal_emit_valist
10: _g_signal_emit
11: _g_application_register
12: _g_application_real_local_command_line
13: _g_application_run
14: ::run
15: noaa_apt::gui::gui::main
16: noaa_apt::main
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

Workaround

Adding .with_utc_timestamps() to the SimpleLogger initialization in line 46 of src/main.rs worked around this problem.

@martinber
Copy link
Owner

Thank you very much!

I put a reminder in my phone to look and understand this in 2 weeks. I think it is slightly better to use local time instead of UTC. Apparently it is something new since the things I found when googling are recent, and I'm afraid that the libraries will change very soon:

@martinber
Copy link
Owner

Now I updated the dependency simple_logger to 2.0.0, this makes the program use .with_utc_timestamps() by default (borntyping/rust-simple_logger#43). I would like to show logs in local time as previously but apparently there is not a simple way to do it in rust safely for all timezones.

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

No branches or pull requests

2 participants