diff options
| author | Meco Man <[email protected]> | 2021-02-11 02:34:38 +0800 |
|---|---|---|
| committer | Meco Man <[email protected]> | 2021-02-11 02:34:38 +0800 |
| commit | d67d4d3fd0ae292677cee9cf9a4d2bb5b5eefb1a (patch) | |
| tree | 74bc7810118cc931144e6cee996229f584f8c293 /components/libc | |
| parent | 51cb109cf8386088368469769d14b1d039551dd1 (diff) | |
add difftime()
Diffstat (limited to 'components/libc')
| -rw-r--r-- | components/libc/compilers/common/time.c | 6 |
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. * |
