MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / now

Method now

nodedb/src/control/sequence/format.rs:167–180  ·  view source on GitHub ↗

Create a context from the current UTC time.

(counter: i64, tenant: &'a str, session_vars: &'a HashMap<String, String>)

Source from the content-addressed store, hash-verified

165impl<'a> FormatContext<'a> {
166 /// Create a context from the current UTC time.
167 pub fn now(counter: i64, tenant: &'a str, session_vars: &'a HashMap<String, String>) -> Self {
168 let dt = nodedb_types::NdbDateTime::now();
169 let c = dt.components();
170 Self {
171 counter,
172 year: c.year as u16,
173 month: c.month,
174 day: c.day,
175 quarter: ((c.month - 1) / 3) + 1,
176 iso_week: iso_week_number(c.year, c.month, c.day),
177 tenant,
178 session_vars,
179 }
180 }
181}
182
183/// Compute ISO 8601 week number (1–53).

Callers 6

stampFunction · 0.45
backup_tenantFunction · 0.45
drain_for_ddlFunction · 0.45
acquire_leaseFunction · 0.45
force_refresh_leaseFunction · 0.45

Calls 3

nowFunction · 0.85
iso_week_numberFunction · 0.85
componentsMethod · 0.45

Tested by

no test coverage detected