Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
人间散章
rt-thread
提交
417f8b9b
R
rt-thread
项目概览
人间散章
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
417f8b9b
编写于
2月 12, 2021
作者:
mysterywolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
107c27f3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
4 deletion
+16
-4
components/libc/compilers/common/time.c
components/libc/compilers/common/time.c
+16
-0
components/libc/compilers/newlib/libc_syms.c
components/libc/compilers/newlib/libc_syms.c
+0
-4
未找到文件。
components/libc/compilers/common/time.c
浏览文件 @
417f8b9b
...
...
@@ -100,12 +100,14 @@ struct tm *gmtime_r(const time_t *timep, struct tm *r)
r
->
tm_isdst
=
0
;
return
r
;
}
RTM_EXPORT
(
gmtime_r
);
struct
tm
*
gmtime
(
const
time_t
*
t
)
{
static
struct
tm
tmp
;
return
gmtime_r
(
t
,
&
tmp
);
}
RTM_EXPORT
(
gmtime
);
/*TODO: timezone */
struct
tm
*
localtime_r
(
const
time_t
*
t
,
struct
tm
*
r
)
...
...
@@ -117,18 +119,21 @@ struct tm* localtime_r(const time_t* t, struct tm* r)
local_tz
=
*
t
+
utc_plus
*
3600
;
return
gmtime_r
(
&
local_tz
,
r
);
}
RTM_EXPORT
(
localtime_r
);
struct
tm
*
localtime
(
const
time_t
*
t
)
{
static
struct
tm
tmp
;
return
localtime_r
(
t
,
&
tmp
);
}
RTM_EXPORT
(
localtime
);
/* TODO: timezone */
time_t
mktime
(
struct
tm
*
const
t
)
{
return
timegm
(
t
);
}
RTM_EXPORT
(
mktime
);
char
*
asctime_r
(
const
struct
tm
*
t
,
char
*
buf
)
{
...
...
@@ -150,28 +155,33 @@ char* asctime_r(const struct tm *t, char *buf)
buf
[
24
]
=
'\n'
;
return
buf
;
}
RTM_EXPORT
(
asctime_r
);
char
*
asctime
(
const
struct
tm
*
timeptr
)
{
static
char
buf
[
25
];
return
asctime_r
(
timeptr
,
buf
);
}
RTM_EXPORT
(
asctime
);
char
*
ctime_r
(
const
time_t
*
tim_p
,
char
*
result
)
{
struct
tm
tm
;
return
asctime_r
(
localtime_r
(
tim_p
,
&
tm
),
result
);
}
RTM_EXPORT
(
ctime_r
);
char
*
ctime
(
const
time_t
*
tim_p
)
{
return
asctime
(
localtime
(
tim_p
));
}
RTM_EXPORT
(
ctime
);
double
difftime
(
time_t
tim1
,
time_t
tim2
)
{
return
(
double
)(
tim1
-
tim2
);
}
RTM_EXPORT
(
difftime
);
/**
* Returns the current time.
...
...
@@ -219,11 +229,13 @@ RT_WEAK time_t time(time_t *t)
return
time_now
;
}
RTM_EXPORT
(
time
);
RT_WEAK
clock_t
clock
(
void
)
{
return
rt_tick_get
();
}
RTM_EXPORT
(
clock
);
int
stime
(
const
time_t
*
t
)
{
...
...
@@ -249,6 +261,7 @@ int stime(const time_t *t)
return
-
1
;
#endif
/* RT_USING_RTC */
}
RTM_EXPORT
(
stime
);
time_t
timegm
(
struct
tm
*
const
t
)
{
...
...
@@ -323,6 +336,7 @@ time_t timegm(struct tm * const t)
i
=
60
;
return
((
day
+
t
->
tm_hour
)
*
i
+
t
->
tm_min
)
*
i
+
t
->
tm_sec
;
}
RTM_EXPORT
(
timegm
);
/* TODO: timezone */
int
gettimeofday
(
struct
timeval
*
tv
,
struct
timezone
*
tz
)
...
...
@@ -341,6 +355,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz)
return
-
1
;
}
}
RTM_EXPORT
(
gettimeofday
);
/* TODO: timezone */
int
settimeofday
(
const
struct
timeval
*
tv
,
const
struct
timezone
*
tz
)
...
...
@@ -355,6 +370,7 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz)
return
-
1
;
}
}
RTM_EXPORT
(
settimeofday
);
#ifdef RT_USING_PTHREADS
static
struct
timeval
_timevalue
;
...
...
components/libc/compilers/newlib/libc_syms.c
浏览文件 @
417f8b9b
...
...
@@ -39,10 +39,6 @@ RTM_EXPORT(snprintf);
RTM_EXPORT
(
fwrite
);
#include <time.h>
RTM_EXPORT
(
localtime
);
RTM_EXPORT
(
time
);
#include <setjmp.h>
RTM_EXPORT
(
longjmp
);
RTM_EXPORT
(
setjmp
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录