add debug time command
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
85f734ec74
commit
111cbea6fc
2 changed files with 10 additions and 2 deletions
|
@ -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<RoomMessageEven
|
|||
"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 {
|
|||
/// invocation.
|
||||
RuntimeInterval,
|
||||
|
||||
/// - Print the current time
|
||||
Time,
|
||||
|
||||
/// - Developer test stubs
|
||||
#[command(subcommand)]
|
||||
#[allow(non_snake_case)]
|
||||
|
|
Loading…
Add table
Reference in a new issue