Update most timestampts to SystemTime

This commit is contained in:
Jonas Platte 2020-04-16 00:19:11 +02:00
parent 206530e10d
commit 207b77b53d
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
4 changed files with 17 additions and 8 deletions

View File

@ -11,6 +11,10 @@ Breaking changes:
* Remove `inhibit_login` request field, make `access_token` and `device_id` response fields optional (added in r0.4.0) * Remove `inhibit_login` request field, make `access_token` and `device_id` response fields optional (added in r0.4.0)
* Remove deprecated `home_server` response field (removed in r0.4.0) * Remove deprecated `home_server` response field (removed in r0.4.0)
* Update `r0::contact::get_contacts` endpoint to r0.6.0 * Update `r0::contact::get_contacts` endpoint to r0.6.0
* Change `UInt` timestamps to `SystemTime` in:
* `media::get_media_preview`
* `push::get_notifications`
* `server::get_user_info`
Improvements: Improvements:

View File

@ -1,6 +1,7 @@
//! [GET /_matrix/media/r0/preview_url](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-media-r0-preview-url) //! [GET /_matrix/media/r0/preview_url](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-media-r0-preview-url)
use js_int::UInt; use std::time::SystemTime;
use ruma_api::ruma_api; use ruma_api::ruma_api;
use serde_json::Value; use serde_json::Value;
@ -20,7 +21,8 @@ ruma_api! {
pub url: String, pub url: String,
/// Preferred point in time (in milliseconds) to return a preview for. /// Preferred point in time (in milliseconds) to return a preview for.
#[ruma_api(query)] #[ruma_api(query)]
pub ts: UInt, #[serde(with = "crate::serde::time::ms_since_unix_epoch")]
pub ts: SystemTime,
} }
response { response {

View File

@ -1,5 +1,7 @@
//! [GET /_matrix/client/r0/notifications](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-notifications) //! [GET /_matrix/client/r0/notifications](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-notifications)
use std::time::SystemTime;
use js_int::UInt; use js_int::UInt;
use ruma_api::{ruma_api, Outgoing}; use ruma_api::{ruma_api, Outgoing};
use ruma_events::{collections::all, EventResult}; use ruma_events::{collections::all, EventResult};
@ -71,6 +73,7 @@ pub struct Notification {
/// The ID of the room in which the event was posted. /// The ID of the room in which the event was posted.
pub room_id: RoomId, pub room_id: RoomId,
/// The unix timestamp at which the event notification was sent, in milliseconds. /// The time at which the event notification was sent, in milliseconds.
pub ts: UInt, #[serde(with = "crate::serde::time::ms_since_unix_epoch")]
pub ts: SystemTime,
} }

View File

@ -1,8 +1,7 @@
//! [GET /_matrix/client/r0/admin/whois/{userId}](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-admin-whois-userid) //! [GET /_matrix/client/r0/admin/whois/{userId}](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-admin-whois-userid)
use std::collections::HashMap; use std::{collections::HashMap, time::SystemTime};
use js_int::UInt;
use ruma_api::ruma_api; use ruma_api::ruma_api;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -38,8 +37,9 @@ ruma_api! {
pub struct ConnectionInfo { pub struct ConnectionInfo {
/// Most recently seen IP address of the session. /// Most recently seen IP address of the session.
pub ip: String, pub ip: String,
/// Unix timestamp that the session was last active. /// Time when that the session was last active.
pub last_seen: UInt, #[serde(with = "crate::serde::time::ms_since_unix_epoch")]
pub last_seen: SystemTime,
/// User agent string last seen in the session. /// User agent string last seen in the session.
pub user_agent: String, pub user_agent: String,
} }