Skip to content

Accept a leading '-' in RationalTime::from_time_string - #2113

Open
kolinabir wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
kolinabir:fix/from-time-string-negative
Open

kolinabir wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
kolinabir:fix/from-time-string-negative

Conversation

@kolinabir

Copy link
Copy Markdown

Negative time strings like -00:00:01.0 were rejected by from_time_string, even though to_time_string produces them. I handle the leading minus first, parse the rest as before, then negate the result. Added tests in Python and C++.

Fixes #2106

Assisted-by: Claude Code / Claude Fable 5.2

to_time_string() writes negative times with a leading '-', and the
header documents that from_time_string() accepts one, but the parser
rejected any string that started with it.

Handle the sign once up front: skip it, parse the rest as a positive
time, and negate the result. A '-' anywhere else is still an error.

Fixes AcademySoftwareFoundation#2106

Signed-off-by: kolinabir <knkolin9@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 27, 2026 18:44
@linux-foundation-easycla

linux-foundation-easycla Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: kolinabir / name: kolinabir (70d7167)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.72%. Comparing base (36e8d4c) to head (70d7167).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2113      +/-   ##
==========================================
+ Coverage   86.70%   86.72%   +0.02%     
==========================================
  Files         186      186              
  Lines       13762    13781      +19     
  Branches     1280     1285       +5     
==========================================
+ Hits        11932    11952      +20     
+ Misses       1660     1659       -1     
  Partials      170      170              
Flag Coverage Δ
cpp-unittests 65.66% <100.00%> (+0.98%) ⬆️
py-unittests 83.90% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/opentime/rationalTime.cpp 85.22% <100.00%> (+0.46%) ⬆️
tests/test_opentime.py 99.75% <100.00%> (+<0.01%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

RationalTime::from_time_string rejects any time string with a leading '-', including the output of to_time_string

3 participants