summaryrefslogtreecommitdiff
path: root/components/libc/compilers/common/time.c
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2021-07-22 00:35:08 +0800
committerMeco Man <[email protected]>2021-07-22 01:08:30 +0800
commit62ff77d4932bb81f5acaf8092cbb97e68de2a9ba (patch)
tree8f02158688719040a66a7f0b7875626a42b55611 /components/libc/compilers/common/time.c
parent0f48449b5e326f4f66e443cbd1a0393ea00433e4 (diff)
[libc][time] 重命名非标准libc函数 并 调整time.h定义位置
Diffstat (limited to 'components/libc/compilers/common/time.c')
-rw-r--r--components/libc/compilers/common/time.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c
index 8f4856a330..6e4ec58950 100644
--- a/components/libc/compilers/common/time.c
+++ b/components/libc/compilers/common/time.c
@@ -465,8 +465,8 @@ RTM_EXPORT(difftime);
RTM_EXPORT(strftime);
#ifdef RT_USING_POSIX
-static struct timeval _timevalue;
-static int clock_time_system_init()
+static volatile struct timeval _timevalue;
+static int _rt_clock_time_system_init()
{
time_t time;
rt_tick_t tick;
@@ -493,7 +493,7 @@ static int clock_time_system_init()
return 0;
}
-INIT_COMPONENT_EXPORT(clock_time_system_init);
+INIT_COMPONENT_EXPORT(_rt_clock_time_system_init);
int clock_getres(clockid_t clockid, struct timespec *res)
{
@@ -614,7 +614,7 @@ int clock_settime(clockid_t clockid, const struct timespec *tp)
}
RTM_EXPORT(clock_settime);
-int clock_time_to_tick(const struct timespec *time)
+int rt_timespec_to_tick(const struct timespec *time)
{
int tick;
int nsecond, second;
@@ -645,19 +645,19 @@ int clock_time_to_tick(const struct timespec *time)
return tick;
}
-RTM_EXPORT(clock_time_to_tick);
+RTM_EXPORT(rt_timespec_to_tick);
#endif /* RT_USING_POSIX */
-/* timezone APIs (Not standard LIBC APIs) */
+/* timezone */
#ifndef RT_LIBC_DEFAULT_TIMEZONE
#define RT_LIBC_DEFAULT_TIMEZONE 8
#endif
#include <rthw.h>
-volatile static rt_int8_t rt_current_timezone = RT_LIBC_DEFAULT_TIMEZONE;
+static volatile rt_int8_t rt_current_timezone = RT_LIBC_DEFAULT_TIMEZONE;
void rt_tz_set(rt_int8_t tz)
{
@@ -669,7 +669,14 @@ void rt_tz_set(rt_int8_t tz)
rt_int8_t rt_tz_get(void)
{
- return rt_current_timezone;
+ rt_int8_t tz;
+ register rt_base_t level;
+
+ level = rt_hw_interrupt_disable();
+ tz = rt_current_timezone;
+ rt_hw_interrupt_enable(level);
+
+ return tz;
}
rt_int8_t rt_tz_is_dst(void)