Skip to content

Commit 6629be4

Browse files
authored
Merge pull request #63 from nickswalker/float-eps
Shift timecode floats forward a few picoseconds
2 parents b3445d6 + 817960a commit 6629be4

3 files changed

Lines changed: 733 additions & 135 deletions

File tree

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
__pycache__
12
.coverage
23
.DS_Store
34
.pytest_cache/*
45
.ruff_cache/*
56
.venv/*
7+
.vscode/*
68
*.egg-info
79
*.egg-info/*
810
*.pyc
@@ -14,5 +16,4 @@ docs/doctrees/*
1416
docs/html/*
1517
docs/latex/*
1618
docs/source/generated/*
17-
include/*
18-
__pycache__
19+
include/*

src/timecode/timecode.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Standard Library Imports
44
from __future__ import annotations
55

6+
import math
67
import sys
78
from contextlib import suppress
89
from typing import TYPE_CHECKING, overload
@@ -885,14 +886,16 @@ def frame_number(self) -> int:
885886
"""
886887
return self.frames - 1
887888

889+
888890
@property
889891
def float(self) -> float:
890892
"""Return the seconds as float.
891893
892894
Returns:
893895
float: The seconds as float.
894896
"""
895-
return float(self.frames) / float(self._int_framerate)
897+
time_value = float(self.frames) / float(self._int_framerate)
898+
return math.nextafter(time_value, math.inf)
896899

897900

898901
class TimecodeError(Exception):

0 commit comments

Comments
 (0)