Newsgroups: comp.std.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: ANSI C date & time library functions. Message-ID: <1990Feb10.220247.25450@utzoo.uucp> Organization: U of Toronto Zoology References: <1990Feb9.183316.24925@utzoo.uucp> Date: Sat, 10 Feb 90 22:02:47 GMT In article flee@shire.cs.psu.edu (Felix Lee) writes: >Are you allowed to compare time_ts without using difftime()? Or >should I write "difftime(now, then) < 0" instead of "now < then"? There is explicitly no guarantee of the internal representation of time_t. Since it is an arithmetic type, you can do direct comparisons... but there is no guarantee that the result will be meaningful. If you want portable comparisons, difftime() is indeed the correct method. >Can time_t be a pointer (converted to an arithmetic if necessary)? >...This is assuming you don't compare time_t values directly and don't >try to read or write them. Unfortunately, there is way too much existing code which assumes that a time_t can be assigned, passed around, etc. A pointer is not an arithmetic type and hence is not a legal time_t type. -- SVR4: every feature you ever | Henry Spencer at U of Toronto Zoology wanted, and plenty you didn't.| uunet!attcan!utzoo!henry henry@zoo.toronto.edu