clockblocks.time_stamp.TimeStampInterval

class clockblocks.time_stamp.TimeStampInterval(start_scheduler_time: float, end_scheduler_time: float, master_clock: Clock)[source]

Bases: object

The oriented span between two moments on the scheduler’s timeline, produced by subtracting two TimeStamps (end_stamp - start_stamp). Like TimeStamp it stores only scheduler times (and the associated master clock) and resolves on demand.

Note that this interval is an anchored interval, not a free-floating duration. Its start and end points are particular moments on the scheduler, and the beat duration of that span in a given clock depends on that clock’s absolute tempo curve between those end points.

Note that, due to floating point arithmetic, two time stamps that were created with a clean time delta may yield a slightly noisy delta when the difference is taken ((start + 0.1) - start is not exactly 0.1 in IEEE-754). For this reason, the duration methods here snap their results to a nice decimal if one is nearby, restoring any intended round durations.

Variables:
  • start_scheduler_time – scheduler-time of the earlier endpoint.

  • end_scheduler_time – scheduler-time of the later endpoint.

Methods

beats_duration_in_clock(clock)

How many beats elapsed in clock across this interval.

time_duration_in_clock(clock)

How much time elapsed across this interval, in clock's own time frame.

Attributes

time_duration_in_master

How much time elapsed across this interval, in the master clock's own time frame.

property time_duration_in_master: float

How much time elapsed across this interval, in the master clock’s own time frame.

beats_duration_in_clock(clock: Clock) → float[source]

How many beats elapsed in clock across this interval.

time_duration_in_clock(clock: Clock) → float[source]

How much time elapsed across this interval, in clock’s own time frame.