Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

etime - Time elapsed between date vectors

Syntax

e = etime(t2, t1)

Description

e = etime(t2, t1) returns the number of 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

etime does not account for the following:

When timing the duration of an event, use the tic and toc functions instead of clock and etime. clock uses the system time, which might be adjusted periodically by the operating system and thus might not be reliable in time comparison operations.

Examples

This example shows two ways to calculate how long a particular FFT operation takes. Using tic and toc is preferred, as it can be more reliable for timing the duration of an event:

x = rand(800000, 1);

t1 = tic;  fft(x);  toc(t1)             % Recommended
Elapsed time is 0.097665 seconds.

t = clock;  fft(x);  etime(clock, t)
ans =
    0.1250

See Also

tic, toc, cputime, clock, now

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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