A2-ai / dvs

Other
0 stars 0 forks source link

rename time_stamp to add_time #18

Open dpastoor opened 3 weeks ago

dpastoor commented 3 weeks ago

Given the time is associated with when the file was added by dvs to the shared location

dpastoor commented 3 weeks ago

https://discord.com/channels/751419551132155925/801487468893175808/1200063991192502312

library(rextendr)

rust_function(r"{
fn now() -> Robj {
    let now = chrono::Local::now();
    let n2 = now.naive_local();

    let posixct = Rfloat::from(n2.timestamp() as f64)
        .into_robj()
        .set_class(&["POSIXct", "POSIXt"])
        .unwrap();

    posixct
}}", dependencies = list("chrono" = "*"))

now()
#> [1] "2024-01-25 03:05:06 EST"
dpastoor commented 3 weeks ago

note this might not work as-is now due to changes in setting attributes that must be mutable now