From 711c103e77cf362b7222de5062127df2ffe7a1f1 Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Wed, 29 May 2013 19:20:12 +0100
Subject: 31422: better heuristic for timestamps in age function
---
Functions/Calendar/age | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
(limited to 'Functions')
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
--
cgit 1.4.1