ethsec

Purpose

Computes the difference between two times, as generated by the date() command, in hundredths of a second.

Format

hs = ethsec(t_start, t_end)
Parameters:
  • t_start (4x1 vector) – starting date, in the order: yr, mo, day, hundredths of a second.

  • t_end (4x1 vector) – ending date, in the order: yr, mo, day, hundredths of a second. MUST be later date than tstart.

Returns:

hs (scalar) – elapsed time measured in hundredths of a second.

Examples

// Set start date
t_start = { 2009, 9, 14, 0 };

// Set ending date
t_end = { 2009, 9, 14, 360 };

// Calculate elapsed hundredths of secs
hs = ethsec(t_start, t_end);

After the code above, hs is equal to:

360
// Set start date
t_start = { 2009, 9, 14, 0 };

// Set ending date
t_end = { 2009, 9, 15, 0 };

// Calculate elapsed hundredths of secs
hs = ethsec(t_start, t_end);

After the code above, hs is equal to:

8640000

which is equal to \(24 \text{ hrs/day } \times 60 \text{ min/hr } \times 60 \text{ secs/min } \times 100 \text{ hsecs/sec}\).

Remarks

This will work correctly across leap years and centuries. The assumptions are a Gregorian calendar with leap years on the years evenly divisible by 4 and not evenly divisible by 100, unless divisible by 400.

Source

time.src

See also

Functions dayinyr()