cirq.Duration

class cirq.Duration(value: Union[None, datetime.timedelta, cirq.Duration] = None, *, picos: Union[int, float, sympy.core.basic.Basic] = 0, nanos: Union[int, float, sympy.core.basic.Basic] = 0, micros: Union[int, float, sympy.core.basic.Basic] = 0, millis: Union[int, float, sympy.core.basic.Basic] = 0)[source]

A time delta that supports symbols and picosecond accuracy.

__init__(value: Union[None, datetime.timedelta, cirq.Duration] = None, *, picos: Union[int, float, sympy.core.basic.Basic] = 0, nanos: Union[int, float, sympy.core.basic.Basic] = 0, micros: Union[int, float, sympy.core.basic.Basic] = 0, millis: Union[int, float, sympy.core.basic.Basic] = 0) → None[source]

Initializes a Duration with a time specified in some unit.

If multiple arguments are specified, their contributions are added.

Parameters
  • value – A value with a pre-specified time unit. Currently only supports 0 and datetime.timedelta instances.

  • picos – A number of picoseconds to add to the time delta.

  • nanos – A number of nanoseconds to add to the time delta.

  • micros – A number of microseconds to add to the time delta.

  • millis – A number of milliseconds to add to the time delta.

Examples

>>> print(cirq.Duration(nanos=100))
100 ns
>>> print(cirq.Duration(micros=1.5 * sympy.Symbol('t')))
(1500.0*t) ns