OxL Справочник OxL
РусскийEnglish

data Hlc

A hybrid logical clock stamp (§17.3): 48 bits of wall-clock milliseconds, a 16-bit counter and the node. Ordered by time, then counter, then node; serializable.

Example:

oxl✓ проверяется в CI
fn main() io {
  let a = cluster.now()
  let b = cluster.now()
  print("{a < b} {a.millis() > 0}")
}
Вывод
true true
@derive(Copy, Eq, Ord, Hash)
pub(api) data Hlc

Потокобезопасность. an immutable value.

С версии. 1.0.0-beta

Поля

pub(api) stamp: i64

(milliseconds << 16) | counter.

pub(api) node: i64

Number of the node that made the stamp.

Методы

millis() -> i64
The wall-clock part, ms since the Unix epoch.
counter() -> i64
The logical counter of the stamp

Определено в: std/core/node.oxl:690

См. также