Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Oct 1995 14:16:44 +0100 (MET)
From:      Piero Serini <piero@strider.ibenet.it>
To:        rkw@dataplex.net (Richard Wackerbarth)
Subject:   Re: Help -- Stupid "C" question.
Message-ID:  <199510271317.OAA14909@strider.ibenet.it>
In-Reply-To: <v02130500acb5df16dbb7@[199.183.109.242]> from "Richard Wackerbarth" at Oct 26, 95 07:05:19 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Hello.

Quoting from Richard Wackerbarth (Fri Oct 27 02:05:19 1995):
> printf("It is now %s\n", ctime(time()));
...
> What should I use?

/*-
 * print current time
 */

#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>

/* ARGSUSED */
#ifdef	__STDC__
int	main(int argc, char *argv[])
#else
int	main(argc, argv)
int	argc;
char	**argv;
#endif	__STDC__
{
	time_t	t = (time_t)0;

	if (time(&t) == (time_t)-1)
		perror("time():"),	exit(1);

	(void) printf("It is now %s", ctime(&t));
	_exit(0);
}


Bye,
--
#        $Id: .signature,v 1.12 1995/08/14 12:10:54 piero Exp $
Piero Serini                                            Via Giambologna, 1 
<Piero@Free.IT>                                     I 20136 Milano - ITALY




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510271317.OAA14909>