Re: Adding a '-D date' option to `cat'

From: Peter Jeremy <peterjeremy_at_optushome.com.au>
Date: Tue, 5 Sep 2006 19:08:29 +1000
On Tue, 2006-Sep-05 10:40:43 +0300, Giorgos Keramidas wrote:
>On 2006-09-05 03:28, Garance A Drosehn <gad_at_freebsd.org> wrote:
>> I intend to commit this within a few days, unless there are major
>> objections to it.  I am posting this HEADSUP under a new subject,
>> so people can dump all kinds of paint over me before I commit it.
>
>If you really plan to commit this, please consider Julian's original
>approach of comparing the gettimeofday() results with previous runs and
>re-using previous output of strftime(), since the latter is probably a
>quite 'expensive' operation.

strftime(3) is relatively cheap (similar to non-FP printf formats).
localtime(3) _is_ relatively expensive though, so this is a good idea.
This is also a trivial change because the strftime() output is already
effectively cached so it's just a matter of caching the time(3) result
and comparing.

(strptime(3) is a very expensive operation but we don't need it).
-- 
Peter Jeremy

Received on Tue Sep 05 2006 - 07:08:32 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:00 UTC