Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Aug 2004 16:49:22 +0200 (MEST)
From:      Mipam <mipam@ibb.net>
To:        freebsd-questions@freebsd.org
Subject:   localtime question
Message-ID:  <Pine.BSO.4.56.0408101646230.26666@ux11.ltcm.net>

next in thread | raw e-mail | index | archive | help
Hi,

I tried to display the time from yesterday by this little program

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

time_t tval;

int main()
{
struct timeval tv;
struct timeval tv_current;
if (gettimeofday(&tv_current, NULL) == -1)
        err(1, "Could not get local time of day");
tv.tv_sec = tv_current.tv_sec-86400;
printf("%s\n", ctime(tv.tv_sec) );
}

But at compilation it complains:

tijd.c: In function `main':
tijd.c:15: warning: passing arg 1 of `ctime' makes pointer from integer 
without a cast

What am i doing wrong?
Bye,

Mipam.



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