Skip to content
Snippets Groups Projects
Commit 111cbea6 authored by Jason Volk's avatar Jason Volk
Browse files

add debug time command


Signed-off-by: default avatarJason Volk <jason@zemos.net>
parent 85f734ec
No related branches found
No related tags found
1 merge request!530de-global services
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
collections::{BTreeMap, HashMap}, collections::{BTreeMap, HashMap},
fmt::Write, fmt::Write,
sync::{Arc, Mutex}, sync::{Arc, Mutex},
time::Instant, time::{Instant, SystemTime},
}; };
use api::client::validate_and_add_event_id; use api::client::validate_and_add_event_id;
use conduit::{ use conduit::{
debug, info, log, debug, info, log,
log::{capture, Capture}, log::{capture, Capture},
warn, Error, PduEvent, Result, utils, warn, Error, PduEvent, Result,
}; };
use ruma::{ use ruma::{
api::{client::error::ErrorKind, federation::event::get_room_state}, api::{client::error::ErrorKind, federation::event::get_room_state},
...@@ -739,3 +739,8 @@ pub(super) async fn runtime_interval(_body: Vec<&str>) -> Result<RoomMessageEven ...@@ -739,3 +739,8 @@ pub(super) async fn runtime_interval(_body: Vec<&str>) -> Result<RoomMessageEven
"Runtime metrics require building with `tokio_unstable`.", "Runtime metrics require building with `tokio_unstable`.",
)) ))
} }
pub(super) async fn time(_body: Vec<&str>) -> Result<RoomMessageEventContent> {
let now = SystemTime::now();
Ok(RoomMessageEventContent::text_markdown(utils::time::format(now, "%+")))
}
...@@ -175,6 +175,9 @@ pub(super) enum DebugCommand { ...@@ -175,6 +175,9 @@ pub(super) enum DebugCommand {
/// invocation. /// invocation.
RuntimeInterval, RuntimeInterval,
/// - Print the current time
Time,
/// - Developer test stubs /// - Developer test stubs
#[command(subcommand)] #[command(subcommand)]
#[allow(non_snake_case)] #[allow(non_snake_case)]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment