summaryrefslogtreecommitdiff
path: root/components/libc
diff options
context:
space:
mode:
Diffstat (limited to 'components/libc')
-rw-r--r--components/libc/compilers/common/time.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c
index 68cd7f0837..366bc28bd1 100644
--- a/components/libc/compilers/common/time.c
+++ b/components/libc/compilers/common/time.c
@@ -12,6 +12,7 @@
* 2021-02-08 Meco Man add settimeofday() stime()
* 2021-02-10 Meco Man add ctime_r() and re-implement ctime()
* 2021-02-11 Meco Man fix bug #3183 - align days[] and months[] to 4 bytes
+ * add difftime()
*/
#include <sys/time.h>
@@ -163,6 +164,11 @@ char* ctime(const time_t *tim_p)
return asctime (localtime (tim_p));
}
+double difftime (time_t tim1, time_t tim2)
+{
+ return (double)(tim1 - tim2);
+}
+
/**
* Returns the current time.
*