ETIME
Keep track of elapsed time
If you want to use etime, then feel free to use Stata's command ssc install to download and install etime:
ssc install etime , replaceDisclaimer: There is no warranty on this software either expressed or implied. This program is released under the terms and conditions of GNU General Public License.
About etime
Programmer: Dan Blanchette (dan_blanchette@unc.edu)
The Carolina Population Center
The University of North Carolina
Chapel Hill, NC USA
Date: 30Sep2003
Last updated: 10Nov2010
Time how long a program runs; or, simply, keep track of the elapsed time from point A to point B in a program
The Carolina Population Center
The University of North Carolina
Chapel Hill, NC USA
Date: 30Sep2003
Last updated: 10Nov2010
Time how long a program runs; or, simply, keep track of the elapsed time from point A to point B in a program
etime [ , start datestart(start date)
timestart(start time)]
Description
etime is designed for programmers who want to keep track of how long a program takes to run.
Using Stata's creturn macro variables:
c(current_date) and c(current_time), etime clocks the difference in time between calls. Like a stopwatch, etime needs to be started and stopped. The second and following times etime is submitted it displays a message that says how long it has been since the first time etime was submitted (in the current Stata session).
c(current_date) and c(current_time), etime clocks the difference in time between calls. Like a stopwatch, etime needs to be started and stopped. The second and following times etime is submitted it displays a message that says how long it has been since the first time etime was submitted (in the current Stata session).
Options
start specifies to set or reset etime. Not specifying start is equivalent to
ending or simply checking the elapsed time.
Options datestart() and timestart() need to be used when timing a command that runs etime or Stata's -macro drop _all- and -sreturn clear-.
datestart specifies to etime to use this start date. The date must be in the
%dD_m_cy format like: 10 Jul 2008 which is the format of
c(current_date). If you specify a
start date you also have to specify time.
timestart specifies to etime to use this start time. The time must be in
hr:min:sec format like: 14:20:58 which is the format of
c(current_time). If you specify a
start time but not the start date, the current date will be used.
Remarks
etime creates global macros $etime_stardate_ and $etime_startime_ .
Examples
. etime, start . etimeDisplays:
Elapsed time is 2 hours 27 minutes 3 seconds
. local date `c(current_date)' . local time `c(current_time)' . etime, d(`date') t(`time') . etime, d(10 Jul 2008) t(03:48:14)
Saved Results
The etime command saves in s():
| Macros: | |
| s(etime) | days:hours:mins:secs elapsed since first call to etime |
| s(esecs) | total number of seconds elapsed since first call to etime |
| s(stardate) | days since Jan. 1, 1960 that etime started |
| s(startime) | number of seconds into the day that etime started |
| s(endate) | days since Jan. 1, 1960 that etime ended |
| s(endtime) | number of seconds into the day that etime ended plus 86,400 seconds for each day since etime started. |
| Global Macros: | |
| $etime_stardate_ | days since Jan. 1, 1960 that etime started |
| $etime_startime_ | number of seconds into the day that etime started |
Also see


