glimr/utils/unix_timestamp

Unix Timestamp Utils

Convenience functions for working with Unix timestamps. Returns the current time as integer seconds or nanoseconds since the Unix epoch (January 1, 1970). Useful for storing timestamps in database columns with unix_timestamp().

Values

pub fn now() -> Int

Returns the current Unix timestamp in seconds since epoch. Use this for storing timestamps in database columns with the unix_timestamp() schema type.

Example:

let created_at = unix_timestamp.now()
// => 1734700800
pub fn now_nano() -> Int

Returns the nanosecond component of the current timestamp. Useful when you need sub-second precision in addition to the seconds from now().

Example:

let nano = unix_timestamp.now_nano()
// => 123456789
Search Document