From d67d4d3fd0ae292677cee9cf9a4d2bb5b5eefb1a Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Thu, 11 Feb 2021 02:34:38 +0800 Subject: add difftime() --- components/libc/compilers/common/time.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'components/libc') 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 @@ -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. * -- cgit v1.3.1