summaryrefslogtreecommitdiff
path: root/components/libc/compilers/common/time.c
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2022-05-24 04:47:35 -0400
committerguo <[email protected]>2022-05-25 10:05:59 +0800
commitc8c24ae7ab13baff799fc634b7242698cc47dfe3 (patch)
tree82c022a6365091acb9412af5c63f687cd2f53b23 /components/libc/compilers/common/time.c
parent4f342456b3f6a672a860bc8a9e604628e5fbc74e (diff)
[libc] revert back difftime
Diffstat (limited to 'components/libc/compilers/common/time.c')
-rw-r--r--components/libc/compilers/common/time.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c
index 8deccbba2c..63b4746618 100644
--- a/components/libc/compilers/common/time.c
+++ b/components/libc/compilers/common/time.c
@@ -307,6 +307,14 @@ char* ctime(const time_t *tim_p)
}
RTM_EXPORT(ctime);
+double difftime(time_t time1, time_t time2)
+{
+ return (double)(time1 - time2);
+}
+RTM_EXPORT(difftime);
+
+RTM_EXPORT(strftime); /* inherent in the toolchain */
+
/**
* Returns the current time.
*
@@ -486,10 +494,6 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz)
}
RTM_EXPORT(settimeofday);
-/* inherent in the toolchain */
-RTM_EXPORT(difftime);
-RTM_EXPORT(strftime);
-
#ifdef RT_USING_POSIX_DELAY
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
{