Structure
UnixTimestamp
Unix epoch seconds. Decodes/encodes as Int64.
struct UnixTimestamp
Overview
Used for Bitcoin Core NUM_TIME fields: time, blocktime, mediantime, lastsend, lastrecv, conntime, etc.
let ts = UnixTimestamp(seconds: 1_700_000_000)
print(ts.date) // 2023-11-14 22:13:20 +0000
print(ts.description) // ISO 8601 formatted string
Note
Some Core fields use 0 as a sentinel for “not set” (e.g., genesis mediantime). Check seconds == 0 at the call site where contextually appropriate, or use Optional<UnixTimestamp> for fields that can be absent.
Note
locktime is not a UnixTimestamp — it’s dual-use (block height when < 500,000,000, epoch seconds when ≥ 500,000,000).
Note
getnettotals.timemillis is epoch milliseconds and uses Int64.
Note
ban_duration / time_remaining are durations in seconds, not epoch timestamps, and use Int64.
Topics
Operators
Initializers
Instance Properties
Instance Methods