ANSI 'C'.

Mike Banahan mikeb at inset.UUCP
Tue Nov 26 20:46:05 AEST 1985


In article <171 at watmath.UUCP> rbutterworth at watmath.UUCP (Ray Butterworth) writes:
>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?

Because they realised that some systems store time in microseconds, others
in encoded formats with seconds in the bottom 6 bits, hours in the next 5,
etc ad nauseam.

The data type may be arithmetic, but its contents aren't guaranteed to be
in any given format. Hence the procedural interfaces.

Perhaps they put more thought into it than you did?
-- 
Mike Banahan, Technical Director, The Instruction Set Ltd.
mcvax!ukc!inset!mikeb



More information about the Comp.lang.c mailing list