aqara 0.1.1

Aqara SDK for Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::time::{SystemTime, UNIX_EPOCH};

use crate::error::Error;

pub(crate) fn unix_timestamp_millis() -> Result<String, Error> {
    let duration = SystemTime::now()
        .duration_since(UNIX_EPOCH)
        .map_err(|e| Error::Transport {
            message: "system clock is before unix epoch".to_string(),
            source: Some(Box::new(e)),
        })?;
    Ok(duration.as_millis().to_string())
}