help-octave
[Top][All Lists]
Advanced

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

Re: inconsistent behavior of 'clock'


From: Mike Miller
Subject: Re: inconsistent behavior of 'clock'
Date: Wed, 24 Mar 1999 09:35:48 -0600 (CST)

On Tue, 23 Mar 1999, John W. Eaton wrote:

> On 21-Mar-1999, Mike Miller <address@hidden> wrote:
> 
> | This leads to another issue.  Why recommend the combined use of etime and
> | clock when we can just use 'time' as follows:
> | 
> | t0=time; big_job; time-t0
> | 
> | instead of the more awkward and inefficient:
> | 
> | t0=clock; big_job; etime(clock,t0)
> | 
> | What do you think?
> 
> I agree.  Does the manual recommend clock and etime over a simple
> difference in the values returned from time?  If so, can you please
> say exactly where?

It doesn't say that "etime,clock" is superior, but it doesn't mention the
alternative...

help -i etime

 - Function File:  etime (T1, T2)
     Return the difference (in seconds) between two time values
     returned from `clock'.  For example:

          t0 = clock ();
          # many computations later...
          elapsed_time = etime (clock (), t0);

     will set the variable `elapsed_time' to the number of seconds since
     the variable `t0' was set.

As a first-time user it took me a while to find the other functions and
realize I could use 'time' instead.  Also, MATLAB doesn't have 'time', but
it does have etime and clock, so people might not notice the availability
of the time function on octave.  Should etime be used for anything except
for compatibility with MATLAB?

Regards,

Mike



reply via email to

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