From 822f0eed9429f71524e739352da3f76d604071d5 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sun, 5 Mar 2023 06:17:43 +0800 Subject: refactor: message record format (#12) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` i am excited -------- 😃💥🎉 -------- ``` --- src/utils.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/utils.rs') diff --git a/src/utils.rs b/src/utils.rs index cb5d1f9..b248d92 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,4 +1,5 @@ use anyhow::{anyhow, Result}; +use chrono::prelude::*; use copypasta::{ClipboardContext, ClipboardProvider}; use std::io::{stdout, Write}; @@ -17,3 +18,8 @@ pub fn paste() -> Result { let mut ctx = ClipboardContext::new().map_err(|err| anyhow!("{err}"))?; ctx.get_contents().map_err(|err| anyhow!("{err}")) } + +pub fn now() -> String { + let now = Local::now(); + now.to_rfc3339_opts(SecondsFormat::Secs, false) +} -- cgit v1.2.3