etime - Time elapsed between date vectors

Syntax

e = etime(t2, t1)

Description

e = etime(t2, t1) returns the time in seconds between vectors t1 and t2. The two vectors must be six elements long, in the format returned by clock:

T = [Year Month Day Hour Minute Second]

Remarks

When timing the duration of an event, use the tic and toc functions instead of clock or etime. These latter two functions are based on the system time which can be adjusted periodically by the operating system and thus might not be reliable in time comparison operations.

The etime function measures time elapsed between two points in time, and does not take into account differences in those points brought about by daylight savings time or changes in time zone.

Examples

Calculate how long a 2048-point real FFT takes.

x = rand(2048, 1);
t = clock;  fft(x);  etime(clock, t)
ans =
      0.4167

Limitations

As currently implemented, the etime function fails across month and year boundaries. Since etime is an M-file, you can modify the code to work across these boundaries if needed.

See Also

clock, cputime, tic, toc

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS