etime
Time elapsed between date vectors
Syntax
Description
Note
While you can represent dates and times as date vectors, it is recommended
that you use datetime
values to
represent points in time, and duration
or calendarDuration
values to
represent elapsed times.
e = etime(
returns the number
of seconds between two date vectors or matrices of date vectors,
t2,t1
)t1
and t2
.
Note: To measure the time required to run code,
use timeit
, or tic
and toc
, instead of
etime
. For more information, see Tips.
Examples
Input Arguments
Tips
To time the duration of an event, use the
timeit
ortic
andtoc
functions instead ofetime
andclock
. Theclock
function is based on the system time, which can be adjusted periodically by the operating system, and thus might not be reliable in time comparison operations.
Algorithms
etime
does not account for the following:
Leap seconds.
Daylight saving time adjustments.
Differences in time zones.