We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 588fd66 commit ead6b57Copy full SHA for ead6b57
1 file changed
timecode/__init__.py
@@ -877,6 +877,20 @@ def float(self) -> float:
877
epsilon = 1e-10 # This is much smaller than 1/framerate for any reasonable framerate
878
return time_value + epsilon
879
880
+ if sys.version_info >= (3, 9):
881
+ # Python 3.9+ supports math.nextafter, which we can use
882
+ # to shift the float by the smallest possible amount
883
+ @property
884
+ def float(self) -> float:
885
+ """Return the seconds as float.
886
+
887
+ Returns:
888
+ float: The seconds as float.
889
+ """
890
+ import math
891
+ time_value = float(self.frames) / float(self._int_framerate)
892
+ return math.nextafter(time_value, math.inf)
893
894
895
class TimecodeError(Exception):
896
"""Raised when an error occurred in timecode calculation."""
0 commit comments