Prev Next

@(@\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@
Returns Elapsed Number of Seconds

Syntax
# include <cppad/utility/elapsed_seconds.hpp>
s = elapsed_seconds()

Purpose
This routine is accurate to within .02 seconds (see elapsed_seconds.cpp ). It does not necessary work for time intervals that are greater than a day.
  1. If the C++11 std::chrono::steady_clock is available, it will be used for timing.
  2. Otherwise, if running under the Microsoft compiler, ::GetSystemTime will be used for timing.
  3. Otherwise, if gettimeofday is available, it is used for timing.
  4. Otherwise, std::clock() will be used for timing.


s
is a double equal to the number of seconds since the first call to elapsed_seconds.

Microsoft Systems
It you are using ::GetSystemTime, you will need to link in the external routine called microsoft_timer .

Example
The routine elapsed_seconds.cpp is an example and test of this routine.
Input File: cppad/utility/elapsed_seconds.hpp