clockblocks.time_stamp.TimeStamp

class clockblocks.time_stamp.TimeStamp(scheduler_time: float, master_clock: Clock)[source]

Bases: object

A clock-agnostic point on the scheduler’s timeline, projectable into any clock’s beat or time axis on demand. Usually captured for the current moment with now() (e.g. at note-on); later queries answer “what beat / time was this in clock X?” for any clock in the same family.

Parameters:
  • scheduler_time – the scheduler-time (canonical, not relative to any clock) this TimeStamp is pinned to. Per-clock beats and times are later derived from it.

  • master_clock – the master clock of the clock family this TimeStamp belongs to.

Variables:

scheduler_time – the scheduler-time this TimeStamp represents.

Methods

beat_in_clock(clock)

Get the beat in clock at the moment this TimeStamp represents.

now([master_clock])

Capture a TimeStamp for the current moment.

time_in_clock(clock)

Get the time in clock at the moment this TimeStamp represents.

Attributes

time_in_master

The time (in the master clock's own time frame) at which this TimeStamp was created.

classmethod now(master_clock: Clock = None) → TimeStamp[source]

Capture a TimeStamp for the current moment. Any clock in the family may be given (its master is used); if omitted, the clock is taken from the current thread.

property time_in_master: float

The time (in the master clock’s own time frame) at which this TimeStamp was created.

beat_in_clock(clock: Clock) → float[source]

Get the beat in clock at the moment this TimeStamp represents.

time_in_clock(clock: Clock) → float[source]

Get the time in clock at the moment this TimeStamp represents.