Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!princeton!caip!seismo!harvard!cmcl2!philabs!micomvax!musocs!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: net.lang.c Subject: Re: time(2 or 3) Message-ID: <441@mcgill-vision.UUCP> Date: Sun, 15-Jun-86 23:48:21 EDT Article-I.D.: mcgill-v.441 Posted: Sun Jun 15 23:48:21 1986 Date-Received: Wed, 18-Jun-86 04:40:28 EDT References: <337@lll-lcc.UUcp> <798@isis.UUCP> Organization: McGill University, Montreal Lines: 33 Keywords: time, localtime In article <798@isis.UUCP>, jay@isis.UUCP (Jay Batson) writes: > In article <337@lll-lcc.UUcp> zingman@lll-lcc.UUcp (Jonathan Zingman) writes: >> [stuff about time(2) and time(3)] > Easy. > #include ... > { > 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@uw-beaver.arpa "Come with me a few minutes, mortal, and we shall talk."