The Unix epoch is the reference instant at 00:00:00 UTC on January 1, 1970. Unix time measures elapsed time from this origin, commonly in seconds. section 17.2
Rust connects the epoch with system-clock measurements:
- SystemTime represents a system clock and can measure how many seconds have passed since 1970. section 17.2
- SystemTime is not monotonic, so a later real-world operation can receive an earlier timestamp. section 17.2
- Instant measures elapsed time for operations, while UNIX_EPOCH provides a readable calendar-time reference. section 17.2
Read elapsed time since the epoch
In Rust, SystemTime::now().duration_since(UNIX_EPOCH) returns a Duration representing the time since January 1, 1970. The example uses unwrap() to obtain the result. section 17.2
use std::time::{SystemTime, UNIX_EPOCH};
fn main() {
println!("{:?}", SystemTime::now().duration_since(UNIX_EPOCH).unwrap());
}
A focused Rust listing showing the standard-library call that measures time since the Unix epoch. section 17.2

