Module attributes
Format a duration (given as a number in seconds) into strings. Return a pair of strings where the first string gives the duration in microseconds and the second string gives the duration as decimal seconds with exactly six digits following the decimal point. Implementation avoids floating-point formatting issues by only using integer arithmetic.
>>> duration = 2478 / 1000000 # 2478 microseconds
>>> time_usec_sec_str(duration)
('2478', '0.002478')
>>> duration = 2478002478 / 100000 # 24780.02478 microseconds
>>> time_usec_sec_str(duration)
('24780024780', '24780.024780')
Use of module attribute NSECS_PER_SEC
>>> frame_duration_nsecs = 10000000
>>> num_frames = 247
>>> duration_secs = num_frames * frame_duration_nsecs / NSECS_PER_SEC
>>> time_usec_sec_str(duration_secs)
('2470000', '2.470000')
Use other module attributes
>>> print '10 millisec frames:', num_frames * frame_duration_nsecs // NSECS_PER_10MILLISEC
10 millisec frames: 247
>>> print 'millisecs:', num_frames * frame_duration_nsecs // NSECS_PER_MILLISEC
millisecs: 2470
>>> print 'microsecs:', num_frames * frame_duration_nsecs // NSECS_PER_MICROSEC
microsecs: 2470000
>>> print 'nanosecs:', num_frames * frame_duration_nsecs
nanosecs: 2470000000