Get The Modification Time Of A File In Epoch Seconds In Rust
I use epoch seconds for tracking when files change in my blog engine. There's a built-in std::fs::Metadata struct` that provides access to the time via a .modified
call. That returns a SystemTime2 which takes a little extra work to turn into an integer. This is what that looks like:
```cargo
= "1.0.93"
```
use fs;
use UNIX_EPOCH;
use PathBuf;
anyhow
Output:
[/Users/alan/.cargo/target/55/19854259915251/_active_nvim_run:13:20] t = 1733162420
It's a few hoops but it gets you there.
-- end of line --
References
After kicking around on the docs for an hour this is where I finally found the full answer for how to pull this off