[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Jean-Benoit Hardouin <jean-benoit.hardouin@neuf.fr> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Time to run a program |

Date |
Wed, 12 May 2004 22:59:53 +0200 |

Excuse me, it miss a part of my message. The original message was :

Note : Elapse permit to consider 24 hours, but the problem is not solve over several days. For my present problem, this procedure is enough.

Jean-Benoit Hardouin

Le Thu, 13 May 2004 08:49:16 +0200, Jean-Benoit Hardouin <jean-benoit.hardouin@neuf.fr> a écrit:

over several days. For my present problem, this procedure is enough.

Jean-Benoit Hardouin

Le Wed, 12 May 2004 20:31:35 +0200, Jean-Benoit Hardouin <jean-benoit.hardouin@neuf.fr> a écrit:

OK thank you everybody for these explanations.

My problem is to save the time of computing, because my aim is to compare by simulations several methods, notably to compare them over the time of computing. These method are very long to run (several hours for one of them, several dizains of minutes for two others, seval seconds for the four last), and I so, the displaying of the time of computing is not enough for me: I must save it.

The rmsg and profiler command don't permit a priori to save this time of computing. Since the simulations can run over several days, I must consider the problem of the date, so the problem is complex.

The elapse command seem to be a solution, as the time of computing can be saved in a global macro ($S_elap) even the obtained result is strange (111 means 1 minute and 11 seconds !!). I test it.

So thank you to Antoine, Ulrich, E. Leuven, Davis and Nick for their help to solve this problem.

Jean-Benoit Hardouin

Le Wed, 12 May 2004 12:40:17 -0400, David Kantor <dkantor@jhu.edu> a écrit:

At 06:06 PM 5/12/2004 +0200, Jean-Benoit Hardouin wrote:this command permet to display the date/time, but don't solve my problem (Perhaps I have not see all the subtleties of this command).

My problem is to compute the time between the beginning and the end of the running of a program.

Thank you for your help.

[...]

As you mentioned in your earlier message, you can take the time using $S_TIME (or, equivalently, c(current_time) ).

I'm usually content to just display them and mentally take the difference. But it is possible to automate this. You would need to textually take apart the time value into its components, and convert to numbers. Thus:

local time1 = c(current_time)

scalar hour1 = real(substr("`time1'", 1, 2))

scalar min1 = real(substr("`time1'", 4, 2))

scalar sec1 = real(substr("`time1'", 7, 2))

Do the same for another moment in time.

Then you need to subtract them. The easiest way would be to convert them into seconds (within the day): hour1 * 3600 + min1 * 60 + sec1.

Of course, there are complications if the run spans different days. I leave that to you.

Good luck.

-- David

David Kantor

Institute for Policy Studies

Johns Hopkins University

dkantor@jhu.edu

410-516-5404

*

* For searches and help try:

* http://www.stata.com/support/faqs/res/findit.html

* http://www.stata.com/support/statalist/faq

* http://www.ats.ucla.edu/stat/stata/

-- ***************************************************************************** Jean-Benoit Hardouin 37 rue Arrachart 41000 Blois tél : 02 54 45 39 75 email : jean-benoit.hardouin@neuf.fr ***************************************************************************** * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**Re: st: Time to run a program***From:*Ulrich Kohler <kohler@wz-berlin.de>

**st: Time to run a program***From:*Jean-Benoit Hardouin <jean-benoit.hardouin@neuf.fr>

**Re: st: Time to run a program***From:*David Kantor <dkantor@jhu.edu>

**Re: st: Time to run a program***From:*Jean-Benoit Hardouin <jean-benoit.hardouin@neuf.fr>

**Re: st: Time to run a program***From:*Jean-Benoit Hardouin <jean-benoit.hardouin@neuf.fr>

- Prev by Date:
**re: st: RE: RE: RE: unpaired regression** - Next by Date:
**Re: st: Time to run a program** - Previous by thread:
**Re: st: Time to run a program** - Next by thread:
**Re: st: Time to run a program** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |