From 74da533ad8e848d2ad3ea08acc1de6d193baeb12 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Tue, 6 Jun 2023 07:36:34 +0800 Subject: Update sync check --- zsh/zshrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'zsh') diff --git a/zsh/zshrc b/zsh/zshrc index 1e31ecf..74b6b63 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -47,9 +47,9 @@ function _get_context() { fi } -function _sync_after_wakeup() { - latest=$(date -d @`stat -c %Y ~/.wakeup` --iso-8601=minutes) - test ! "$latest" = "$(cat ~/.wakeup)" +function _need_sync_after_wakeup() { + latest=$(date -d @`stat -c %Y ~/.wakeup` +%s) + test "$latest" -ge "$(cat ~/.wakeup)" } autoload -Uz add-zsh-hook @@ -71,7 +71,7 @@ function precmd() { # Show context and git status of tracking repos at right UNSYNC_REPOS=$(NUM=$($SETTING_DIR/bin/git/check-repos.sh -n); (( $NUM != 0 )) && echo $NUM) _get_context - NEED_SYNC=$(_sync_after_wakeup || echo S) + NEED_SYNC=$(_need_sync_after_wakeup || echo S) RPROMPT="%B%K{blue}%F{yellow}${CONTEXT:+ $CONTEXT }%f%k%K{red}%F{black}${UNSYNC_REPOS}${NEED_SYNC}%f%k%b" -- cgit v1.2.3-70-g09d2