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},
|
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
|
||||||
"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 {
|
||||||
/// 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)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue