help-octave
[Top][All Lists]
Advanced

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

Re: inconsistent behavior of 'clock'


From: John W. Eaton
Subject: Re: inconsistent behavior of 'clock'
Date: Tue, 23 Mar 1999 17:46:17 -0600 (CST)

On 21-Mar-1999, Mike Miller <address@hidden> wrote:

| Well, after spending a bunch of time on it, I found the old bug reports
| and I see that it's fixed in newer versions of Octave.  I'm still using
| the stable version.  Anyway, as everyone seems to know, the bug was in
| localtime--it rounds off sec instead of using floor.
| 
| 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?

| Don't they do the same thing in theory?  In practice,
| both localtime and clock stand in the middle and can cause errors when
| etime is used.  So 'time' alone is easier and more efficient.

Yes.

Also, if you want cpu time instead of wall clock time, you should use
the cputime function instead.

jwe



reply via email to

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