added three time option #574

This commit is contained in:
DustInDark
2022-06-08 18:50:30 +09:00
parent af9fed4d2e
commit 781117f206
3 changed files with 66 additions and 4 deletions
+10 -3
View File
@@ -592,10 +592,17 @@ fn format_rfc<Tz: TimeZone>(time: &DateTime<Tz>) -> String
where
Tz::Offset: std::fmt::Display,
{
if configs::CONFIG.read().unwrap().args.is_present("rfc-2822") {
let time_args = &configs::CONFIG.read().unwrap().args;
if time_args.is_present("rfc-2822") {
time.to_rfc2822()
} else if configs::CONFIG.read().unwrap().args.is_present("rfc-3339") {
time.to_rfc3339()
} else if time_args.is_present("rfc-3339") {
time.format("%Y-%m-%d %H:%M:%S%.6f%:z").to_string()
} else if time_args.is_present("US-time") {
time.format("%m-%d-%Y %I:%M:%S%.3f %p %:z").to_string()
} else if time_args.is_present("US-military-time") {
time.format("%m-%d-%Y %H:%M:%S%.3f %:z").to_string()
} else if time_args.is_present("European-time") {
time.format("%d-%m-%Y %H:%M:%S%.3f %:z").to_string()
} else {
time.format("%Y-%m-%d %H:%M:%S%.3f %:z").to_string()
}
+4 -1
View File
@@ -87,7 +87,10 @@ fn build_app<'a>() -> ArgMatches<'a> {
--start-timeline [START_TIMELINE] 'Start time of the event logs to load. (Example: \"2018-11-28 12:00:00 +09:00\")'
--end-timeline [END_TIMELINE] 'End time of the event logs to load. (Example: \"2021-11-28 12:00:00 +09:00\")'
--rfc-2822 'Output date and time in RFC 2822 format. (Example: Mon, 07 Aug 2006 12:34:56 -0600)'
--rfc-3339 'Output date and time in RFC 3339 format. (Example: 2006-08-07T12:34:56.485214 -06:00)'
--rfc-3339 'Output date and time in RFC 3339 format. (Example: 2006-08-07 12:34:56.485214-06:00)'
--US-time 'Output date time in US time format. (Example: 08-07-2006 00:34:56.485 PM -6:00)'
--US-military-time 'Output date time in US military time format. (Example: 08-07-2006 12:34:56.485 -6:00)'
--European-time 'Output date time in European time format. (Example: 07-08-2006 12:34:56.485 +2:00)'
-U, --utc 'Output time in UTC format. (Default: local time)'
--no-color 'Disable color output.'
-t, --thread-number [NUMBER] 'Thread number. (Default: Optimal number for performance.)'