Re: Function Signatures In time.h
- From: August Karlstrom <fusionfive@xxxxxxxxx>
- Date: Sun, 30 Apr 2006 15:49:26 GMT
Diomidis Spinellis wrote:
August Karlstrom wrote:OK, thanks for the input. On the other hand, the function difftime
Does anyone know why some of the functions in time.h use pointers to constant objects of type time_t when time_t is an aritmetic type. Why is e.g. ctime declared as
char* ctime(const time_t* tp);
and not as
char* ctime(time_t t);
My guess is that this is an implementation decision related to the environment where C has its roots. In the Seventh Edition Unix (and probably also in earlier versions), time_t is implemented as a long
<http://minnie.tuhs.org/UnixTree/V7/usr/include/sys/types.h.html>. On a PDP-11 where that 1979 version of Unix run, passing as an argument a 16 bit pointer to a 32 bit long was probably more efficient than passing the actual 32 bit value.
double difftime(time_t t2, time_t t1);
does not use pointer arguments.
August
.
- Follow-Ups:
- Re: Function Signatures In time.h
- From: Keith Thompson
- Re: Function Signatures In time.h
- References:
- Function Signatures In time.h
- From: August Karlstrom
- Re: Function Signatures In time.h
- From: Diomidis Spinellis
- Function Signatures In time.h
- Prev by Date: Re: help me learn C
- Next by Date: Re: Boost process and C
- Previous by thread: Re: Function Signatures In time.h
- Next by thread: Re: Function Signatures In time.h
- Index(es):