修复shell获取时间

This commit is contained in:
whyour
2022-07-17 13:24:59 +08:00
parent 9f0503f138
commit f016e6734a
2 changed files with 29 additions and 16 deletions
+11
View File
@@ -401,6 +401,17 @@ format_time() {
fi
}
format_log_time() {
local format="$1"
local time="$2"
if [[ $is_macos -eq 1 ]]; then
echo $(date -j -f "$format" "$time" "+%Y-%m-%d-%H-%M-%S")
else
echo $(date -d "$time" "+%Y-%m-%d-%H-%M-%S")
fi
}
format_timestamp() {
local format="$1"
local time="$2"