ANSI 'C'.

Andrew Koenig ark at alice.UucP
Fri Nov 22 06:37:40 AEST 1985


> The standard obviously didn't put much thought into anything related to
> times.  They define type "time_t" as an arithmetic type that represents
> the time, and then define a difftime(time_t time1,time_t time2) that
> computes the difference between these two arithmetic values.  Why the
> function?  Does the standard have a new arithmetic type on which the
> operation of subtraction is not allowed?
> And then they define a function gmtime(const time_t *timer) that takes
> a pointer to the arithmetic value, which it is not going to change anyway.
> Why not just take the value itself instead of the pointer?

gmtime takes a pointer rather than the value itself for historical
reasons.  Before C had long integers, gmtime() took an array of
two integers as its argument.  Since C does not pass arrays by value,
gmtime() actually saw a pointer.



More information about the Comp.lang.c mailing list