From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9194 invoked by alias); 22 May 2013 20:01:22 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 31422 Received: (qmail 18057 invoked from network); 22 May 2013 20:01:08 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: neutral (ns1.primenet.com.au: 74.125.82.179 is neither permitted nor denied by SPF record at ntlworld.com) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-proxyuser-ip:date:from:to:subject:message-id:in-reply-to :references:x-mailer:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=99b9oL3eiXRNb5SHSbQyhJfXwqIPA6i6PKug0zYfKWM=; b=XacGHfDX+ChDSqv7VbwWRNUOCd4kEUORMEMP0aCjq+nPH9sjQGoy7lKDR/Gz6r+HbS g3755qxxIpMgKvk9lIsyzStXMiUyGWZDEVoDzcuROvUlsAd0x8Jw/Tx+QPGLQ3ZofhFH UNnLnQ4yXoHxXMxNMsu1dv49wP+s8nWlPrddbatxoMrwARpt0dERukkxpMZda7+ST/A6 Jy2lSmpPoJbDgNzzouN45QRsr9Uh/CuHtJ47pYYAsDFjDSYOvqUOIW/kk4HLWCw+vLAE 9qgjH0WSBscvfrg8K7IQTVq46Pnd71vmGc5/pVv1Y9QsCGLpd4lKnD/VEa5H7Tuud4V0 USGQ== X-Received: by 10.180.185.244 with SMTP id ff20mr37169616wic.0.1369252851726; Wed, 22 May 2013 13:00:51 -0700 (PDT) X-ProxyUser-IP: 86.6.30.159 Date: Wed, 22 May 2013 21:00:48 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: Missing "--" in the "age" function Message-ID: <20130522210048.04db0bfb@pws-pc.ntlworld.com> In-Reply-To: <20130522094601.4bdd8fbe@pwslap01u.europe.root.pri> References: <20130521115332.GA9976@chaz.gmail.com> <20130521161928.5c59471f@pwslap01u.europe.root.pri> <20130521191022.GB9976@chaz.gmail.com> <20130522094601.4bdd8fbe@pwslap01u.europe.root.pri> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQn6XRlYpAJTsg2mVXBehjs6bh8SLI2ZodQUpBoxfPP35tW+mC6qRkKAsH3WiWY+LwAUEDhk On Wed, 22 May 2013 09:46:01 +0100 Peter Stephenson wrote: > Maybe the most convenient thing is if you give one :file argument it > uses the date, and if there is a second argument it uses the date and > time for both? diff --git a/Doc/Zsh/calsys.yo b/Doc/Zsh/calsys.yo index b3eb454..7dc51ab 100644 --- a/Doc/Zsh/calsys.yo +++ b/Doc/Zsh/calsys.yo @@ -665,10 +665,15 @@ Instead of an explicit date and time, it's possible to use the modification time of a file as the date and time for either argument by introducing the file name with a colon: +example(print *+LPAR()e-age :file1-+RPAR()) + +matches all files created on the same day (24 hours starting from +midnight) as tt(file1). + example(print *+LPAR()e-age :file1 :file2-+RPAR()) -This matches all files modified no earlier than tt(file1) and -no later than tt(file2). +matches all files modified no earlier than tt(file1) and +no later than tt(file2); precision here is to the nearest second. texinode(Calendar Styles)(Calendar Utility Functions)(Calendar System User Functions)(Calendar Function System) sect(Styles) diff --git a/Functions/Calendar/age b/Functions/Calendar/age index c636bdf..17cf4d1 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 -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/