Use SystemTime for timestamp fields

This commit is contained in:
Isaiah Inuwa 2020-05-23 08:02:47 -05:00
parent 250da9281a
commit e4c7a81a7c
3 changed files with 7 additions and 5 deletions

View File

@ -18,6 +18,6 @@ matches = "0.1.8"
ruma-api = "0.16.0-rc.3"
ruma-events = "0.21.0-beta.1"
ruma-identifiers = "0.16.0"
ruma-serde = "0.1.0"
ruma-serde = "0.2.1"
serde = { version = "1.0.106", features = ["derive"] }
serde_json = "1.0.51"

View File

@ -2,7 +2,7 @@
#![warn(missing_docs)]
use std::collections::BTreeMap;
use std::{collections::BTreeMap, time::SystemTime};
use ::serde::{Deserialize, Serialize};
use js_int::UInt;
@ -27,7 +27,8 @@ pub struct RoomV3Pdu {
pub origin: String,
/// Timestamp (milliseconds since the UNIX epoch) on originating homeserver
/// of when this event was created.
pub origin_server_ts: UInt,
#[serde(with = "ruma_serde::time::ms_since_unix_epoch")]
pub origin_server_ts: SystemTime,
// TODO: Replace with event content collection from ruma-events once that exists
/// The event's type.

View File

@ -1,6 +1,6 @@
//! [PUT /_matrix/federation/v1/send_join/{roomId}/{eventId}](https://matrix.org/docs/spec/server_server/r0.1.3#put-matrix-federation-v1-send-join-roomid-eventid)
use std::collections::BTreeMap;
use std::{collections::BTreeMap, time::SystemTime};
use js_int::UInt;
use ruma_api::ruma_api;
@ -35,7 +35,8 @@ ruma_api! {
pub origin: String,
/// Timestamp (milliseconds since the UNIX epoch) on originating homeserver
/// of when this event was created.
pub origin_server_ts: UInt,
#[serde(with = "ruma_serde::time::ms_since_unix_epoch")]
pub origin_server_ts: SystemTime,
// TODO: Replace with event content collection from ruma-events once that exists
/// The event's type.