(description from #52)
Added a mean to get the timestamps of a given SMPTE Timecode. Two timebases are considered:
- Video system time:
to_systemtime()
- Real time:
to_realtime()
NTSC framerates will return different values as the system time is not aligned to the wall-clock time. All others should return the exact same value.
DF 29.97:
> tc = Timecode("29.97", '00:59:59;29')
> tc.to_systemtime()
'01:00:00.000'
> tc.to_realtime()
'00:59:59.996'
NDF 29.97:
> tc = Timecode("29.97", '00:59:59:29', force_non_drop_frame=True)
> tc.to_systemtime()
'01:00:00.000'
> tc.to_realtime()
'01:00:03.600'
PAL 50:
> tc = Timecode("50", '00:59:59:49')
> tc.to_systemtime()
'01:00:00.000'
> tc.to_realtime()
'01:00:00.000'
I did not implement setters as I don't think there's a meaningful usage or need to them.
Hopefully this may help others understand better Timecodes running at different rates and the relations to the wall-clock time.
The second commit is to preserve the drop frame flag on elementary operations.
> tc = Timecode(29.97, '00:00:00:00', force_non_drop_frame=True)
> assert tc.drop_frame is False
> tc = tc + 1
> tc
'00:00:00:01' #before: '00:00:00;01'
> tc.drop_frame
False #before: True
Thanks for @cubicibo for contribution.
As usual, version 1.4.0
is also released to PyPI and running pip install timecode
will install it.