1 /*
2 Copyright (c) 1994 Cygnus Support.
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms are permitted
6 provided that the above copyright notice and this paragraph are
7 duplicated in all such forms and that any documentation,
8 and/or other materials related to such
9 distribution and use acknowledge that the software was developed
10 at Cygnus Support, Inc.  Cygnus Support, Inc. may not be used to
11 endorse or promote products derived from this software without
12 specific prior written permission.
13 THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  */
17 /*
18  * difftime.c
19  * Original Author:	G. Haley
20  */
21 
22 /*
23 FUNCTION
24 <<difftime>>---subtract two times
25 
26 INDEX
27 	difftime
28 
29 SYNOPSIS
30 	#include <time.h>
31 	double difftime(time_t <[tim1]>, time_t <[tim2]>);
32 
33 DESCRIPTION
34 Subtracts the two times in the arguments: `<<<[tim1]> - <[tim2]>>>'.
35 
36 RETURNS
37 The difference (in seconds) between <[tim2]> and <[tim1]>, as a <<double>>.
38 
39 PORTABILITY
40 ANSI C requires <<difftime>>, and defines its result to be in seconds
41 in all implementations.
42 
43 <<difftime>> requires no supporting OS subroutines.
44 */
45 
46 #include <time.h>
47 
48 double
difftime(time_t tim1,time_t tim2)49 difftime (time_t tim1,
50 	time_t tim2)
51 {
52   return (double)(tim1 - tim2);
53 }
54