* Help in measuring time
@ 1995-06-21 4:00 Falguni Sarkar
1995-06-21 4:00 ` Sam Pawley
0 siblings, 1 reply; 2+ messages in thread
From: Falguni Sarkar @ 1995-06-21 4:00 UTC (permalink / raw)
I am using a DEC Alpha machine. When I try to compile the
following code I am facing problems.
#include <stdio.h>
#include <time.h>
time_t tim1,*tp;
main(){
tim1=time(tp);
if(tp==NULL)
printf("tp is NULL\n");
}
If I use cc then tp is always returned as NULL. If I use
gcc for compilation, no executable file gets created and
the following message is displayed.
In file included from /usr/include/sys/timers.h:99,
from /usr/local/lib/gcc-lib/alpha-dec-osf3.2/2.6.3/include/time.h:174,
from sample.c:2:
/usr/local/lib/gcc-lib/alpha-dec-osf3.2/2.6.3/include/sys/signal.h:225: field `sigev_value' has incomplete type
I need to evalute the physical time between two successive points
in one of my experimental program. Hence I am using the function
time(), which is returning me always NULL values or the programs
do not compile. I will highly appreciate any suggestion about
how to fix this.
Thanks in advance,
Falguni Sarkar.
E-mail : sarkar@ponder.csci.unt.edu
--
Falguni Sarkar
Dept. of Computer Science
University of North Texas
Denton, TX 76203
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Help in measuring time
1995-06-21 4:00 Help in measuring time Falguni Sarkar
@ 1995-06-21 4:00 ` Sam Pawley
0 siblings, 0 replies; 2+ messages in thread
From: Sam Pawley @ 1995-06-21 4:00 UTC (permalink / raw)
sarkar@ponder.csci.unt.edu (Falguni Sarkar) writes:
>I am using a DEC Alpha machine. When I try to compile the
>following code I am facing problems.
>#include <stdio.h>
>#include <time.h>
>time_t tim1,*tp;
>main(){
> tim1=time(tp);
> if(tp==NULL)
> printf("tp is NULL\n");
>}
It should read...
(appropriate #includes)
main()
{
time_t tim1, tim2;
time(&tim1);
/* do the stuff to be timed */
time(&tim2);
printf("Took %d seconds to run\n", tim2 - tim1);
}
The parameter passed to time() needs to be the address of some storage.
Just declaring it as "time_t *tp;" does not alocate any storage, it just
declares tp to be a pointer to a time_t (an unsigned long int). Time() is
pretty low resolution. It only returns whole seconds. You might want to
try some of the higher resolution methods that Ive seen posted here.
EMail me for copies if you need them.
Hope this helps!
-=[ SamBones ]=-
-=-=-=-=-=-=-=-=-=-=-=-=-=-+-=-=-=-=-=-+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"Hungry man, reach for the | This | pawley@tnc.airtouch.com
book: it is a weapon!" | space for | sam.pawley@atlas.ccmail.airtouch.com
Bertold Brecht | Rent | (714) 798-2050
-=-=-=-=-=-=-=-=-=-=-=-=-=-+-=-=-=-=-=-+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1995-06-21 4:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-06-21 4:00 Help in measuring time Falguni Sarkar
1995-06-21 4:00 ` Sam Pawley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox