Skip to content

Builtin Interfaces

These are primitive types which do not have schema definitions but are the basic primitive building blocks for schemas.

Duration

builtin_interfaces.Duration — signed time span (sec + nanosec).

Same wire format as :class:Time.

Time

builtin_interfaces.Time — POSIX-style timestamp.

Wire format: 12 bytes total (4-byte CDR encapsulation header + i32 sec + u32 nanosec). Negative sec represents pre-epoch timestamps; :meth:to_nanos returns None in that case since the value can't be represented as u64.

from_cdr classmethod

from_cdr(buf: BufferLike) -> Time

Decode a standalone CDR Time buffer.

from_nanos staticmethod

from_nanos(nanos: int) -> Time

Construct from a 64-bit nanosecond count.

to_bytes

to_bytes() -> bytes

Encode as a standalone CDR buffer (12 bytes).

to_nanos

to_nanos() -> Optional[int]

Convert to nanoseconds, or None for pre-epoch (negative sec).