4.2BSD ctime() arguments

sloane at noscvax.UUCP sloane at noscvax.UUCP
Tue Apr 10 07:54:04 AEST 1984


Whenever I use gmtime() lint complains about arguments, saying that
the 1st argument to gmtime() is used inconsistently. I mucked about
and found the following:

	from 'man ctime':     

           struct tm *gmtime(clock);
           long *clock;

	from /usr/lib/lint/llib-lc:	
		
		struct tm * gmtime(c) time_t *c {returns gmtime(c)}

	from /usr/include/sys/types.h:
		
		typedef int time_t;
			 
This seems to indicate that the argument to gmtime() should be of type
time_t (according to llib-lc) which is an int (according to sys/types.h)
rather than a long (as man ctime would lead one to believe).

Compiling my program with the argument declared as an int both worked
and stopped lint from complaining. Is the man page in error or am I
hopelessly lost? And is it safe to use an int for the argument to
gmtime()?


      Gary K. Sloane
      c/o Naval Ocean Systems Center
      COTD Building 1 Room B205
      San Diego, California 92152

      MILNET: sloane at nosc
      UUCP:   ...{sdcsvax}!nosc-cc!sloane
      DDD: (619) 225-8401 x391



More information about the Comp.unix.wizards mailing list