How to construct a SystemTime or Instant from seconds


#1

I could not find any method that given the time in seconds since 1970 can construct either a SystemTime or Instant. From the docs it seems the only way of constructing those is via now(). However, I’m parsing a message and it contains the time in seconds, how to convert it?


#2
use std::time::{Duration, SystemTime, UNIX_EPOCH};

let time = UNIX_EPOCH + Duration::from_secs(epoch_seconds);