summaryrefslogtreecommitdiff
path: root/libc/time/difftime.c
diff options
context:
space:
mode:
authorProjectRevoTPP <projectrevotpp@hotmail.com>2017-12-20 16:34:35 -0500
committerProjectRevoTPP <projectrevotpp@hotmail.com>2017-12-20 16:34:35 -0500
commit48ef7704c03e7e554c05de01bf8d1d70c16cb6f4 (patch)
tree34d52513de6c903b4f52ef87d885c73472daf469 /libc/time/difftime.c
parentf49e7cbb33e6e27b0ce5eb35244d7241c800a7c1 (diff)
add libc building to agbcc.
Diffstat (limited to 'libc/time/difftime.c')
-rw-r--r--libc/time/difftime.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/libc/time/difftime.c b/libc/time/difftime.c
new file mode 100644
index 0000000..93a4f00
--- /dev/null
+++ b/libc/time/difftime.c
@@ -0,0 +1,44 @@
+/*
+ * difftime.c
+ * Original Author: G. Haley
+ */
+
+/*
+FUNCTION
+<<difftime>>---subtract two times
+
+INDEX
+ difftime
+
+ANSI_SYNOPSIS
+ #include <time.h>
+ double difftime(time_t <[tim1]>, time_t <[tim2]>);
+
+TRAD_SYNOPSIS
+ #include <time.h>
+ double difftime(<[tim1]>, <[tim2]>)
+ time_t <[tim1]>;
+ time_t <[tim2]>;
+
+DESCRIPTION
+Subtracts the two times in the arguments: `<<<[tim1]> - <[tim2]>>>'.
+
+RETURNS
+The difference (in seconds) between <[tim2]> and <[tim1]>, as a <<double>>.
+
+PORTABILITY
+ANSI C requires <<difftime>>, and defines its result to be in seconds
+in all implementations.
+
+<<difftime>> requires no supporting OS subroutines.
+*/
+
+#include <time.h>
+
+double
+_DEFUN (difftime, (tim1, tim2),
+ time_t tim1 _AND
+ time_t tim2)
+{
+ return ((double) tim1 - tim2);
+}