summaryrefslogtreecommitdiff
path: root/Functions/Calendar
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2013-05-29 19:20:12 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2013-05-29 19:20:12 +0100
commit711c103e77cf362b7222de5062127df2ffe7a1f1 (patch)
treeac3560365e81e0c528cce2a4e8dbd976294b80a3 /Functions/Calendar
parenta46aef770467e00a259f8215162bcc4e7cc7f1f0 (diff)
downloadzsh-711c103e77cf362b7222de5062127df2ffe7a1f1.tar.gz
zsh-711c103e77cf362b7222de5062127df2ffe7a1f1.zip
31422: better heuristic for timestamps in age function
Diffstat (limited to 'Functions/Calendar')
-rw-r--r--Functions/Calendar/age10
1 files changed, 8 insertions, 2 deletions
diff --git a/Functions/Calendar/age b/Functions/Calendar/age
index c636bdfe8..17cf4d13e 100644
--- a/Functions/Calendar/age
+++ b/Functions/Calendar/age
@@ -33,6 +33,7 @@ zmodload -i zsh/parameter
autoload -Uz calendar_scandate
+local timefmt
local -a vals tmp
[[ -e $REPLY ]] || return 1
@@ -40,14 +41,19 @@ zstat -A vals +mtime -- $REPLY || return 1
if (( $# >= 1 )); then
if [[ $1 = :* ]]; then
- zstat -A tmp -F "%Y/%m/%d" +mtime -- ${1#:} || return 1
+ if (( $# > 1 )); then
+ timefmt="%Y/%m/%d:%H:%M:%S"
+ else
+ timefmt="%Y/%m/%d"
+ fi
+ zstat -A tmp -F $timefmt +mtime -- ${1#:} || return 1
local AGEREF=$tmp[1]
else
local AGEREF=$1
fi
# if 1 argument given, never use globally defined AGEREF2
if [[ $2 = :* ]]; then
- zstat -A tmp -F "%Y/%m/%d" +mtime -- ${2#:} || return 1
+ zstat -A tmp -F "%Y/%m/%d:%H:%M:%S" +mtime -- ${2#:} || return 1
local AGEREF2=$tmp[1]
else
local AGEREF2=$2