I'm using time::PrimitiveDateTime and I would like to create a new var with the current time but I cannot find how. Isn't there something like now()?
What about Instant::now()?
Example:
pub struct Player {
updated_at: Option<PrimitiveDateTime>
}
impl Player {
pub fn set_updated_at(&mut self) {
let now = Instant::now();
self.updated_at = Some(time::PrimitiveDateTime::from(now));
}
But obviously this doesn't work:
mismatched types
expected struct `time::PrimitiveDateTime`, found struct `time::Instant` rustc E0308