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

Issues when system date is far in advance #189

Closed
rickpayne opened this issue Sep 27, 2021 · 4 comments · Fixed by #250
Closed

Issues when system date is far in advance #189

rickpayne opened this issue Sep 27, 2021 · 4 comments · Fixed by #250
Labels
good first issue Good for newcomers

Comments

@rickpayne
Copy link

No description provided.

@rickpayne rickpayne changed the title Issues when system date is far in ava Issues when system date is far in advance Sep 27, 2021
@rickpayne
Copy link
Author

I had an issue on my laptop with suspend which caused the system date to be set a long way in advance. This then caused issues with atuin when it was trying to calculate the duration:

thread 'main' panicked at 'called Result::unwrap()on anErr value: OutOfRangeError(())', src/command/search.rs:45:67 stack backtrace: 0: rust_begin_unwind at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:515:5 1: core::panicking::panic_fmt at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:92:14 2: core::result::unwrap_failed at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/result.rs:1599:5 3: atuin::command::search::draw 4: atuin::command::search::select_history::{{closure}} 5: atuin::command::AtuinCmd::run::{{closure}} 6: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll 7: atuin::main

I was able to fix this by deleting the offending entries from the history.db with

delete from history where timestamp > 3111965300000000000;

An example of a screwed up entry:
603e6b2fe45742f5ae6c43f6dce2038f|3111965300517021519|38294589|0|date|/home/rickp|2440cee000ea453dadfa69a122d2db6e|clifford:rickp

@conradludgate
Copy link
Collaborator

Yeah seems that atuin assumes that all time entries happen in the past. It subtracts the provided timestamp from now and then tries to turn that into a human readable time like 5m ago or 2wks ago.

I suppose it's possible to check that time, see if it's in the future and change it to be in 2wks. Admittedly, that might be confusing but it would stop the panic

@ellie ellie added the good first issue Good for newcomers label Sep 29, 2021
@ellie
Copy link
Member

ellie commented Sep 29, 2021

Yup this definitely needs sorting, thanks for raising it! An incorrect assumption for sure

I've labelled this as a good issue to get started with. Happy to help anyone through it 👍

@TimB87
Copy link

TimB87 commented Oct 31, 2021

Daylight saving time came in like a wrecking ball here

ellie added a commit that referenced this issue Dec 19, 2021
Resolve #189

We were throwing an OutOfRangeError. This occurs when you attempt to
convert to a duration, and your input is <0. A value in the future would
have done this. This is especially noticeable during DST...
ellie added a commit that referenced this issue Dec 19, 2021
Resolve #189

We were throwing an OutOfRangeError. This occurs when you attempt to
convert to a duration, and your input is <0. A value in the future would
have done this. This is especially noticeable during DST...
ellie added a commit that referenced this issue Dec 19, 2021
Resolve #189

We were throwing an OutOfRangeError. This occurs when you attempt to
convert to a duration, and your input is <0. A value in the future would
have done this. This is especially noticeable during DST...
ellie added a commit that referenced this issue Dec 20, 2021
Resolve #189

We were throwing an OutOfRangeError. This occurs when you attempt to
convert to a duration, and your input is <0. A value in the future would
have done this. This is especially noticeable during DST...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants