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

Fix issue with negative times in date_time and add tests for full coverage #198

Merged
merged 5 commits into from Oct 12, 2023

Conversation

Flamefire
Copy link
Collaborator

When handling negative times (double value) the fractional part (i.e. nanoseconds) is subtracted from the seconds to make the nanoseconds positive. However the subtraction happened on a temporary value, not the result struct leading to off-by-one errors

Also add some more tests to fully cover date_time.cpp (which led to the discovery of the above bug),
especially the date_time constructors taking a calendar and the handling of the "active" time-zone were not sufficiently tested

The fractional part (sub-seconds) was not handled correctly
(subtracting the second only from a temporary)
Fix this and add tests, also for comparing sub-second differences.
@codecov
Copy link

codecov bot commented Oct 11, 2023

Codecov Report

Merging #198 (303e141) into develop (2cdef1a) will increase coverage by 0.32%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #198      +/-   ##
===========================================
+ Coverage    94.93%   95.26%   +0.32%     
===========================================
  Files          114      114              
  Lines         9917    10001      +84     
===========================================
+ Hits          9415     9527     +112     
+ Misses         502      474      -28     
Files Coverage Δ
include/boost/locale/date_time.hpp 95.03% <100.00%> (+0.10%) ⬆️
include/boost/locale/hold_ptr.hpp 94.44% <100.00%> (-1.02%) ⬇️
src/boost/locale/shared/date_time.cpp 100.00% <100.00%> (+12.90%) ⬆️
test/test_date_time.cpp 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2cdef1a...303e141. Read the comment docs.

@Flamefire Flamefire merged commit d97969a into boostorg:develop Oct 12, 2023
47 checks passed
@Flamefire Flamefire deleted the date_time-coverage branch October 12, 2023 07:08
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.

None yet

1 participant