question about ctime(3) and time(2) in unix v6

gwyn at Brl-Vld.ARPA gwyn at Brl-Vld.ARPA
Sat Mar 31 05:24:41 AEST 1984


From:      Doug Gwyn (VLD/VMB) <gwyn at Brl-Vld.ARPA>

The reason for int tval[2] instead of long tval was that the original
6th Edition UNIX C or its precursors did not know about the "long" data
type, so two (short) ints were used to hold long data.

I suspect your real problem however is that you are not declaring
the type of the time() function to be a long.  If you fail to declare
a function, C will assume that it is int-valued.

You should also look at the actual source for the time() function.  I
have seen at least three versions of this on 6th Edition UNIXes.  Maybe
yours does not return a long value but rather a 0-or-1 success
indicator (in which case, call time() first then call ctime() later
with the address of the storage that ctime() filled).



More information about the Comp.unix.wizards mailing list