bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Timing an operation


From: Paul Jarc
Subject: Re: Timing an operation
Date: Thu, 24 May 2007 11:46:37 -0400
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux)

Matthew_S <address@hidden> wrote:
> Can i have something like;
>
> if 
> difference between dates <5seconds 
> echo fail
> fi

date1=`perl -e 'print time()'`
...
date2=`perl -e 'print time()'`
interval=`expr "$date2" - "$date1"`
if test 5 -gt "$interval"; then
  echo fail
fi

On some systems, you could also use "date +%s" instead of perl, if you
prefer.


paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]