[ILUG] C compilation error

Niall O Broin niall at linux.ie
Sun Jan 27 00:00:46 GMT 2002


On Sat, Jan 26, 2002 at 09:53:39PM +0000, Nick Murtagh wrote:
> On Saturday 26 January 2002 21:30, you wrote:
> > OK - this tiny program
> >
> > ---------------------
> > #include <sys/time.h>
> >
> > main() {
> >   struct tm *tp;
> >
> >   tp = localtime();
> >   tp->tm_isdst;
> > }
> > ---------------------
> 
> What exactly is localtime() supposed to do? As far as i can tell

The definition of localtime was quoted in my first post from the man page

struct tm *localtime(const time_t *timep);

but I mistakenly removed the argument and the warning was generated because
of the unknown function localtime (because its definition in time.h wasn't
included - see other response). Nothing to do with Perl, BTW, Kevin - the
real program has


tp = localtime(&tbuf.time);
tdiff = TIMEDIFF - tbuf.timezone * 60;
if (tp->tm_isdst)
   tdiff += 60 * 60;
   
The question of why sys/time.h is not including time.h remains open.



Niall




More information about the ILUG mailing list