Expand description
The time Vector stamps and judges by: this device’s clock, corrected when the account’s
relays agree it is off. Every HTTPS answer carries a Date (RFC 9110 §6.6.1), so any relay
can tell the time, whether or not it serves NIP-11; their median moves the clock, so one wrong
relay can’t, and nothing of Vector’s own is asked.
Structs§
- Status
- What the clock is doing, for Settings.
Constants§
- EVENT
- What the UI hears when the clock in force, or what is known about it, changes.
- SETTING_
KEY - The account setting:
"false"keeps the device’s clock, anything else follows the relays.
Functions§
- describe_
span - A length of time as a person says it: “40 seconds”, “4 minutes”, “2 hours”.
- device_
clock_ reads - Every place under
src_rootthat reads the time off the device rather than this clock, aspath:linerelative tocrate_root:Timestamp::now(), unix time fromSystemTime, and signing with bare keys through nostr’sfinalize, which stamps the device’s clock. A read that must stay on the device (a file’s age, a log line, an id) says why with// device-clock: <why>on its line or the three above. - is_
decentralised - Whether Vector runs on the relays’ clock.
- load_
setting - Read the live account’s choice. Called as its session starts.
- now_ms
- Now, in unix ms, on the clock in force.
- now_
secs - Now, in unix seconds, on the clock in force.
- offset_
ms - The correction in force, in ms (positive when this device runs behind). Zero on the device clock.
- restamp
- Move an event nostr stamped with the device’s clock onto the clock in force. A time the caller chose (a backdated wrap, an edition’s own date) is left alone, and so is the id it fixed.
- resync_
soon - Ask the relays again soon, rather than at the next hourly check: a server said this clock is off.
- set_
decentralised - Choose the relays’ clock or the device’s, for this account, from now on.
- status
- sync_
with - Ask
relaysfor the time and correct the clock by what they agree on. Leaves it alone when fewer thanQUORUManswer alike, the device’s clock is used until they do. - timestamp
- Now, as the
created_ator filter bound of an event. Use this, neverTimestamp::now().