time(2 or 3)

der Mouse mouse at mcgill-vision.UUCP
Mon Jun 16 13:48:21 AEST 1986


In article <798 at isis.UUCP>, jay at isis.UUCP (Jay Batson) writes:
> In article <337 at lll-lcc.UUcp> zingman at lll-lcc.UUcp (Jonathan Zingman) writes:
>> [stuff about time(2) and time(3)]
> Easy.
> #include <time.h>
...
> {
> 	long somevar1;
...
> 	/* ok, first get ahold of the number of seconds since Jan 1, 1970 */
> 	somevar1 = time(0);
...
> } /* end some_fcn */

     Not quite that simple.

(1) Does time.h declare time() to return long?  Make sure it does, or
declare it yourself.

(2) The call to time() is wrong.  It should be time((long *)0), unless
of course you have an ANSI-conforming compiler and time.h gives a
prototype instead of a bare declaration (how many people do you think
are so lucky?  Not many.).
-- 
					der Mouse

USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse
     philabs!micomvax!musocs!mcgill-vision!mouse
Europe: mcvax!decvax!utcsri!mcgill-vision!mouse
        mcvax!seismo!cmcl2!philabs!micomvax!musocs!mcgill-vision!mouse
ARPAnet: utcsri!mcgill-vision!mouse at uw-beaver.arpa

"Come with me a few minutes, mortal, and we shall talk."



More information about the Comp.lang.c mailing list