ANSI standard for difftime()

scott at tdpvax.UUCP scott at tdpvax.UUCP
Sat Jul 1 12:41:00 AEST 1989



I have a copy of _The Waite Group's Essential Guide to ANSI C_ and it has
difftime() defined as the __elapsed__ time between to time_t values.  It 
declaration is.

double difftime(time_t time2, time_t time1);

and it returns time2 - time1.


My question is can this value be negative?  Since elapsed time is normally
a positive value.  What should difftime do if time1 is greater than time2.  I
tried this under a VMS compiler and it returned a negative value.  So
what is the _OFFICIAL_ ANSI standard say.  Since the arguments for and
against have already been made please don't make them here.  If you have
access to the PANS draft or KNOW the answer please reply.    Thanx.


                                Scott King
                                trsvax!tdpvax!scott
                                trsvax!tdpvax!scott at uxc.cso.uiuc.edu

So when do we get to see Rocky take on the Karate kid.  Or Jason take on Jaws?



More information about the Comp.std.c mailing list