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 deprecated `home_server` response field (removed in r0.4.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:

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)
use js_int::UInt;
use std::time::SystemTime;
use ruma_api::ruma_api;
use serde_json::Value;
@ -20,7 +21,8 @@ ruma_api! {
pub url: String,
/// Preferred point in time (in milliseconds) to return a preview for.
#[ruma_api(query)]
pub ts: UInt,
#[serde(with = "crate::serde::time::ms_since_unix_epoch")]
pub ts: SystemTime,
}
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)
use std::time::SystemTime;
use js_int::UInt;
use ruma_api::{ruma_api, Outgoing};
use ruma_events::{collections::all, EventResult};
@ -71,6 +73,7 @@ pub struct Notification {
/// The ID of the room in which the event was posted.
pub room_id: RoomId,
/// The unix timestamp at which the event notification was sent, in milliseconds.
pub ts: UInt,
/// The time at which the event notification was sent, in milliseconds.
#[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)
use std::collections::HashMap;
use std::{collections::HashMap, time::SystemTime};
use js_int::UInt;
use ruma_api::ruma_api;
use ruma_identifiers::UserId;
use serde::{Deserialize, Serialize};
@ -38,8 +37,9 @@ ruma_api! {
pub struct ConnectionInfo {
/// Most recently seen IP address of the session.
pub ip: String,
/// Unix timestamp that the session was last active.
pub last_seen: UInt,
/// Time when that the session was last active.
#[serde(with = "crate::serde::time::ms_since_unix_epoch")]
pub last_seen: SystemTime,
/// User agent string last seen in the session.
pub user_agent: String,
}