Skip to content

Commit

Permalink
修复 mac 时间格式化
Browse files Browse the repository at this point in the history
  • Loading branch information
whyour committed Sep 29, 2024
1 parent 3f71f9a commit 6ea8d36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion shell/otask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ run_concurrent() {
fi

handle_env_split
single_log_time=$(date "+%Y-%m-%d-%H-%M-%S.%3N")
time=$(date "+$mtime_format")
single_log_time=$(format_log_time "$mtime_format" "$time")

cd $dir_scripts
local relative_path="${file_param%/*}"
Expand Down
2 changes: 1 addition & 1 deletion shell/share.sh
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ format_log_time() {
local time="$2"

if [[ $is_macos -eq 1 ]]; then
echo $(date -j -f "$format" "$time" "+%Y-%m-%d-%H-%M-%S-%3N")
echo $(python3 -c 'from datetime import datetime; print(datetime.now().strftime("%Y-%m-%d-%H-%M-%S-%f")[:-3])')
else
echo $(date -d "$time" "+%Y-%m-%d-%H-%M-%S-%3N")
fi
Expand Down

0 comments on commit 6ea8d36

Please sign in to comment.