Expand description
The small amount of calendar arithmetic a scheduler needs.
The framework has no date type: rustlavel-db deliberately leaves a
timestamptz column as text so precision survives, and core has nothing
richer than SystemTime. A cron schedule cannot be computed without real
calendar maths, so this module carries the minimum — seconds since the Unix
epoch in and out of a civil UTC date, and nothing else.
Everything the queue stores is epoch seconds rather than a timestamp column, for the same reason: an integer compares and sorts identically in every driver, and no part of the system has to agree on a text format.
The conversions are Howard Hinnant’s days_from_civil / civil_from_days,
chosen because they are exact for every year in range and short enough to
verify by reading.
Structs§
- Date
Time - A civil date and time in UTC.
Constants§
- SECONDS_
PER_ DAY - Seconds in a day. Leap seconds do not exist in Unix time, so this is exact.
Functions§
- from_
unix - Split epoch seconds into a civil UTC date and time.
- start_
of_ day - The start of the day containing
seconds. - start_
of_ minute - The start of the minute containing
seconds. - to_unix
- Build epoch seconds from a civil UTC date and time.
- unix_
now - Now, in seconds since the epoch.