mc-server-wrapper icon indicating copy to clipboard operation
mc-server-wrapper copied to clipboard

Time Error

Open Nathanwoodburn opened this issue 3 years ago • 3 comments

I'm getting time error. It has been happening since I installed the wrapper. image

Nathanwoodburn avatar Nov 14 '22 09:11 Nathanwoodburn

Interesting, are you using one of the compiled binaries available for download from the releases page on this GitHub repo or did you compile the binary yourself? And what OS / OS version are you running it on?

Cldfire avatar Nov 24 '22 03:11 Cldfire

I compiled it on Ubuntu Linux.

Nathanwoodburn avatar Nov 24 '22 04:11 Nathanwoodburn

Gotcha. So there's a .cargo/config file that's supposed to set a compilation flag to stop that from happening:

https://github.com/Cldfire/mc-server-wrapper/blob/c4ed71eee57bd1970fc17b6be1c33859ab40e483/.cargo/config.toml#L1-L5

It's possible that either cargo isn't picking up the compilation flag when you're compiling it locally (which I'm not sure how to direct you to debug) or that there's an error determining the local offset for some other reason. You might want to try downloading the last Linux binary from https://github.com/Cldfire/mc-server-wrapper/releases and seeing if you get time in the logs with that.

The other thing you could try is editing this code:

https://github.com/Cldfire/mc-server-wrapper/blob/c4ed71eee57bd1970fc17b6be1c33859ab40e483/mc-server-wrapper/src/logging.rs#L74-L87

to this:

let record = format!(
    "[{}] [{}, {}]: {}",
    time::OffsetDateTime::now_utc()
        .format(&CONSOLE_TIMESTAMP_FORMAT)
        .unwrap_or_else(|_| String::from("time error")),
    record.target(),
    record.level(),
    record.args()
);

That'll get you UTC time with no local offset, which is (seemingly) infallible. If you do that you probably want to mess with the time formatting above there and go from 12h -> 24h time too (ideally time formatting would be configurable in the config at some point).

Cldfire avatar Nov 24 '22 04:11 Cldfire