1989-06-12 15:22:14 +00:00
|
|
|
/*
|
1989-12-18 15:33:48 +00:00
|
|
|
* difftime - compute the difference between two calendar times
|
1989-06-12 15:22:14 +00:00
|
|
|
*/
|
1994-06-24 14:02:31 +00:00
|
|
|
/* $Id$ */
|
1989-06-12 15:22:14 +00:00
|
|
|
|
2018-06-21 20:33:47 +00:00
|
|
|
#include <time.h>
|
1989-06-12 15:22:14 +00:00
|
|
|
|
|
|
|
double
|
|
|
|
difftime(time_t time1, time_t time0)
|
|
|
|
{
|
1990-09-11 10:18:51 +00:00
|
|
|
/* be careful: time_t may be unsigned */
|
2018-06-21 20:33:47 +00:00
|
|
|
if ((time_t)-1 > 0 && time0 > time1)
|
|
|
|
{
|
|
|
|
return -(double)(time0 - time1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1990-09-11 10:18:51 +00:00
|
|
|
return (double)(time1 - time0);
|
|
|
|
}
|
1989-06-12 15:22:14 +00:00
|
|
|
}
|