From: dqua@earthlink.net (Derick J.R. Qua-Gonzalez)
Subject: Re: Help in computing time....
Date: 1995/06/21 [thread overview]
Message-ID: <dqua.803746341@nntp.earthlink.net> (raw)
In-Reply-To: 3s884v$7qj@hermes.acs.unt.edu
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");
>}
>If I use cc then tp is always returned as NULL.
Mr. Sarkar, the problem stems from the fact that time() cannot modify
the value of the pointer tp; it could only change the copy it has.
The argument of time, if non-NULL, is where a the time value is
stuffed, in addition to being returned, otherwise the argument is
ignored completely. To get the time, either:
time(&tim1);
or:
tim1=time(NULL);
will work just fine and return the time to you in the variable tim1.
>Thanks in advance,
>Falguni Sarkar.
Best regards,
--
+----------------------------------------------------------------------------+
| Derick R. Qua-Gonzalez | ________ |
| Department of High Energy Physics | \ / |
| California State University | \ / |
| dqua@Prometheus.EarthLink.Net | \ / |
| | G \/ |
+----------------------------------------------------------------------------+
| It is better to be hated for what one is, than loved for what one is not. |
| (A. Gide) |
+----------------------------------------------------------------------------+
next prev parent reply other threads:[~1995-06-21 4:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-06-21 4:00 Help in computing time Falguni Sarkar
1995-06-21 4:00 ` Derick J.R. Qua-Gonzalez [this message]
1995-06-21 4:00 ` Michael W. Walker
1995-06-27 4:00 ` D'Arcy J.M. Cain
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox