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

find/time: calculate midnight with local time zone #467

Merged
merged 3 commits into from
Oct 19, 2024

Conversation

NaviHX
Copy link
Contributor

@NaviHX NaviHX commented Oct 17, 2024

No description provided.

@cakebaker cakebaker linked an issue Oct 17, 2024 that may be closed by this pull request
Copy link

codecov bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.59%. Comparing base (dce8b2d) to head (c1db23c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #467      +/-   ##
==========================================
+ Coverage   66.50%   66.59%   +0.09%     
==========================================
  Files          36       36              
  Lines        4436     4439       +3     
  Branches      991      978      -13     
==========================================
+ Hits         2950     2956       +6     
- Misses       1062     1064       +2     
+ Partials      424      419       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cakebaker
Copy link
Contributor

It looks like you are using some deprecated functions:

error: use of deprecated method `chrono::DateTime::<Tz>::date`: Use `date_naive()` instead
  --> src/find/matchers/time.rs:28:41
   |
28 |         let local_midnight = local_time.date().and_hms(0, 0, 0);
   |                                         ^^^^
   |
   = note: `-D deprecated` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(deprecated)]`

error: use of deprecated method `chrono::Date::<Tz>::and_hms`: Use and_hms_opt() instead
  --> src/find/matchers/time.rs:28:48
   |
28 |         let local_midnight = local_time.date().and_hms(0, 0, 0);
   |

@sylvestre
Copy link
Contributor

  • it will need tests to make sure we don't regress :)

@NaviHX
Copy link
Contributor Author

NaviHX commented Oct 18, 2024

It looks like you are using some deprecated functions:

error: use of deprecated method `chrono::DateTime::<Tz>::date`: Use `date_naive()` instead
  --> src/find/matchers/time.rs:28:41
   |
28 |         let local_midnight = local_time.date().and_hms(0, 0, 0);
   |                                         ^^^^
   |
   = note: `-D deprecated` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(deprecated)]`

error: use of deprecated method `chrono::Date::<Tz>::and_hms`: Use and_hms_opt() instead
  --> src/find/matchers/time.rs:28:48
   |
28 |         let local_midnight = local_time.date().and_hms(0, 0, 0);
   |

I removed the use of DateTime::date and Date::and_hms .

  • it will need tests to make sure we don't regress :)

I added a test find::matchers::time::tests::get_local_midnight .

Copy link
Collaborator

@hanbings hanbings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks!

@hanbings hanbings merged commit 526079b into uutils:main Oct 19, 2024
19 checks passed
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

Successfully merging this pull request may close these issues.

-daystart option does not calculate midnight with local time zone
4 participants