From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14038 invoked by alias); 10 Aug 2011 15:41:42 -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: 29668 Received: (qmail 18897 invoked from network); 10 Aug 2011 15:41:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) 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, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Wed, 10 Aug 2011 16:41:13 +0100 From: Peter Stephenson To: "Zsh Hackers' List" Subject: Re: PATCH: zsh/datetime $EPOCHREALTIME Message-ID: <20110810164113.3169c0a1@pwslap01u.europe.root.pri> In-Reply-To: <110810083017.ZM4722@torch.brasslantern.com> References: <20110810122137.3a3e4c00@pwslap01u.europe.root.pri> <20110810124120.0479177b@pwslap01u.europe.root.pri> <110810083017.ZM4722@torch.brasslantern.com> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.103.11.26] X-Scanned-By: MailControl A-12-01-02 (www.mailcontrol.com) on 10.68.0.127 On Wed, 10 Aug 2011 08:30:17 -0700 Bart Schaefer wrote: > On Aug 10, 12:41pm, Peter Stephenson wrote: > } > } I'm actually wondering if we ought to be a bit smarter and add an > } epochrealtime array with the seconds and nanoseconds as elements > } (guaranteed to be consistent, obviously). Exercise for the reader. > > Better (?) still: > > Allow the user to apply typeset to EPOCHSECONDS. If it's an int, > it is as it is now. If it's a float, what you called EPOCHREALTIME. > If an array, elements for seconds and nanoseconds. If a hash, the > keys are tv_sec and tv_nsec like a timespec (convert from tv_usec > when using gettimeofday). > > Too bad that would require mucking about with whether it's special > and readonly, or else introducing provision for other special cases > into typeset ... That's the trick I did with SECONDS, but a utility library like zsh/datetime might be called in lots of different places and come a cropper if the type is wrong (e.g. supplying a float to strftime screws up), so I thought it would be better to minimise the assumptions needed. -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog