Commit f4b89e17 authored by Bernhard M. Wiedemann's avatar Bernhard M. Wiedemann
Browse files

Add simplified Rust SDE example

tested with rust 1.70 and chrono 0.4.26
parent 8335c30f
Loading
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -384,6 +384,16 @@ sys.env.get("SOURCE_DATE_EPOCH")

Using the `chrono` crate:

```rust
use chrono::{TimeZone, Utc};
use std::env;

let now = match env::var("SOURCE_DATE_EPOCH") {
    Ok(val) => { Utc.timestamp_opt(val.parse::<i64>().unwrap(), 0).unwrap() }
    Err(_) => Utc::now(),
};
```
or
```rust
use chrono::{DateTime, NaiveDateTime, Utc};
use std::env;