Skip to content

Latest commit

 

History

History
31 lines (24 loc) · 1007 Bytes

File metadata and controls

31 lines (24 loc) · 1007 Bytes

Time Values

MoonProto public API uses MoonTime: a compact Unix-milliseconds timestamp. It is cheap to copy, works naturally with Rust/UI code, and can be converted to SystemTime when a framework needs it.

The protocol still uses MoonBot wire time (f64 days since 1899-12-30) on the wire. That is converted at packet boundaries. Application code should not store or compare raw wire-day floats.

use moonproto::MoonTime;

let now = MoonTime::now();
let unix_ms = now.unix_millis();
let unix_seconds = now.unix_seconds();
let system_time = now.system_time();

Common retained rows expose helper methods:

let trade_ms = trade.time().unix_millis();
let candle_ms = candle.time().unix_millis();
let last_price_time = point.time().system_time();
let order_open_ms = order.buy_order.open_time().unix_millis();
let trace_ms = chart_point.time().unix_millis();

Diagnostic builds keep hidden wire-time helpers for byte-level protocol tests. They are not the normal terminal API.