From 111cbea6fc70b25fde58a33dc1e8594de79040e0 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 24 Jul 2024 00:15:03 +0000 Subject: [PATCH] add debug time command Signed-off-by: Jason Volk --- src/admin/debug/commands.rs | 9 +++++++-- src/admin/debug/mod.rs | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/admin/debug/commands.rs b/src/admin/debug/commands.rs index 4efefce7..ff68641c 100644 --- a/src/admin/debug/commands.rs +++ b/src/admin/debug/commands.rs @@ -2,14 +2,14 @@ use std::{ collections::{BTreeMap, HashMap}, fmt::Write, sync::{Arc, Mutex}, - time::Instant, + time::{Instant, SystemTime}, }; use api::client::validate_and_add_event_id; use conduit::{ debug, info, log, log::{capture, Capture}, - warn, Error, PduEvent, Result, + utils, warn, Error, PduEvent, Result, }; use ruma::{ api::{client::error::ErrorKind, federation::event::get_room_state}, @@ -739,3 +739,8 @@ pub(super) async fn runtime_interval(_body: Vec<&str>) -> Result) -> Result { + let now = SystemTime::now(); + Ok(RoomMessageEventContent::text_markdown(utils::time::format(now, "%+"))) +} diff --git a/src/admin/debug/mod.rs b/src/admin/debug/mod.rs index 82b37c53..77bc36b8 100644 --- a/src/admin/debug/mod.rs +++ b/src/admin/debug/mod.rs @@ -175,6 +175,9 @@ pub(super) enum DebugCommand { /// invocation. RuntimeInterval, + /// - Print the current time + Time, + /// - Developer test stubs #[command(subcommand)] #[allow(non_snake_case)]