Measuring running time in a general + portable way

U

upperclass

Hi,

I'm trying to find a decent way of measuring the running time of a
long-running program.
Say, the running time ranges from several seconds to more than a day.

The standard clock() function seems inadequate for this task.
(I read somewhere in this group that clock_t would likely overflow
after <1 hour).

Is there any better solution that can deal with this and be portable?
Thank you.
 
I

Ian Collins

Richard said:
I am puzzled. The header info is:

Path:
border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.rapidnet.com!news.rapidnet.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 25 Apr 2007 20:22:21 -0500
From: (e-mail address removed) (Richard Harter)
Newsgroups: comp.lang.c
Subject: Re: Measuring running time in a general + portable way
Date: Thu, 26 Apr 2007 13:22:00 GMT

In my view of the header (and probably Chuck's), Date (as set by your
agent) was 04/27/07 06:54, which usually happens when the sender system
clock is wrong. The NNTP-Posting-Date is set by the server.

Only your postings appear to be in the future.
 
R

Richard Heathfield

Richard Harter said:
Ian says he's seeing my posting as coming in the future. Do you see
this also?

No. In my view (er, literally!), he is mistaken.
 
J

Joachim Schmitz

Richard Harter said:
Ian says he's seeing my posting as coming in the future. Do you see
this also?
Yes.

Confused am with pm? I see a 12 hours difference

Bye, Jojo
 
I

Ian Collins

Richard said:
Richard Harter said:



No. In my view (er, literally!), he is mistaken.
I'm not, something software is!

Richard's postings appear to have a date 24 hours ahead of their
NNTP-Posting-Date.
 
C

CBFalconer

These posts show up here, converted to local time, as:

3:01 AM
3:27 PM
4:29 AM
5:16 PM

which smells like a 12 hour displacement in your time setting.
 
R

Richard Heathfield

Ian Collins said:
Richard Heathfield wrote:
In my view (er, literally!), [Ian Collins] is mistaken.
I'm not, something software is!

Richard [Harter]'s postings appear to have a date 24 hours ahead of
their NNTP-Posting-Date.

Ian, I spoke too soon and I owe you an apology.

Here is an extract from a Richard Harter header - in fact, it's taken
from the same header that he quoted himself in an effort to defend his
system:

NNTP-Posting-Date: Wed, 25 Apr 2007 20:22:21 -0500
From: (e-mail address removed) (Richard Harter)
Newsgroups: comp.lang.c
Subject: Re: Measuring running time in a general + portable way
Date: Thu, 26 Apr 2007 13:22:00 GMT

The discrepancy between NNTP-Posting-Date and the apparent date is very
evident.
 
F

Flash Gordon

Richard Heathfield wrote, On 26/04/07 11:59:
Ian Collins said:
Richard Heathfield wrote:
In my view (er, literally!), [Ian Collins] is mistaken.
I'm not, something software is!

Richard [Harter]'s postings appear to have a date 24 hours ahead of
their NNTP-Posting-Date.

Ian, I spoke too soon and I owe you an apology.

Here is an extract from a Richard Harter header - in fact, it's taken
from the same header that he quoted himself in an effort to defend his
system:

NNTP-Posting-Date: Wed, 25 Apr 2007 20:22:21 -0500
From: (e-mail address removed) (Richard Harter)
Newsgroups: comp.lang.c
Subject: Re: Measuring running time in a general + portable way
Date: Thu, 26 Apr 2007 13:22:00 GMT

The discrepancy between NNTP-Posting-Date and the apparent date is very
evident.

I suggest checking the timezone on the machine, AM/PM and the date. The
Date header says the time is in GMT and I don't think Richard Harter is
in a country using GMT as its timezone.

13:22 - 5:00 gives us 8:00 (I got the -5 from the offset on the posting
date).
An AM/PM error deals with the difference between 8:22 and 20:22.
 
R

Richard Harter

Hi,

I'm trying to find a decent way of measuring the running time of a
long-running program.
Say, the running time ranges from several seconds to more than a day.

The standard clock() function seems inadequate for this task.
(I read somewhere in this group that clock_t would likely overflow
after <1 hour).

Is there any better solution that can deal with this and be portable?
Thank you.

IIANM, difftime will portably give you the difference between two wall
clock times. See time.h. If you have posix (widely available) you can
a finer resolution than seconds.
 
R

Richard Harter

These posts show up here, converted to local time, as:

3:01 AM
3:27 PM
4:29 AM
5:16 PM

which smells like a 12 hour displacement in your time setting.

And so it is. Until I just changed it, it read 10:47 PM. It should be
okay now. Blush, blush.

Thanks muchly, everyone.
 
R

Richard Harter

date
Thu Apr 26 18:58:54 NZST 2007

Your posting was dated 04/27/07 06:54

I am puzzled. The header info is:

Path:
border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.rapidnet.com!news.rapidnet.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 25 Apr 2007 20:22:21 -0500
From: (e-mail address removed) (Richard Harter)
Newsgroups: comp.lang.c
Subject: Re: Measuring running time in a general + portable way
Date: Thu, 26 Apr 2007 13:22:00 GMT
Message-ID: <[email protected]>
References: <[email protected]>
X-Newsreader: Forte Free Agent 1.1/32.230
Lines: 21
NNTP-Posting-Host: 208.53.229.199
X-Trace:
sv3-rXZz57965mmdYAuUVuQRD17DWMURcFlXdXbDMUfMXl43d/T9ZXu6mX3LcF/m6gzUkMzDCQCu+XGcizQ!9GakYvoucalohljq5M2o1XqHkbjAC2SCYvRKqvGjmKFnu/DwLjRCBkrPNmJTaIsnZs6DYQpsDns=
X-Complaints-To: (e-mail address removed)
X-DMCA-Complaints-To: (e-mail address removed)
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
complaint properly
X-Postfilter: 1.3.34
Xref: number1.nntp.dca.giganews.com comp.lang.c:743832

Where are you getting this 04/27/07 06:54 from?
 
R

Richard Harter

In my view of the header (and probably Chuck's), Date (as set by your
agent) was 04/27/07 06:54, which usually happens when the sender system
clock is wrong. The NNTP-Posting-Date is set by the server.

Only your postings appear to be in the future.

This is very weird. My clock has the correct time and date. Moreover
the times show up correctly when I download them.
 
R

Richard Harter

Richard Harter said:


Why? Have you never seen people make mistakes before?

Ian says he's seeing my posting as coming in the future. Do you see
this also?
 
R

Richard Bos

CBFalconer said:
These posts show up here, converted to local time, as:

3:01 AM
3:27 PM
4:29 AM
5:16 PM

which smells like a 12 hour displacement in your time setting.

Another proof that the 24-hour clock is superior to your poncy USAnian
12-hour one...

Richard, g,d,rlb
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top