summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorMan, Jianting (Meco) <[email protected]>2022-06-22 01:41:06 -0400
committerGitHub <[email protected]>2022-06-22 13:41:06 +0800
commit2c10d5ad01315275254ff59b881a8f323e2636bb (patch)
tree71c98c880693d19bfeb74952532f64d6f7ac9c0a /components
parent4f1f8566f48961c7ee877d1d5226f0be03a06395 (diff)
[rtc] use gmtime_r to replace gmtime (#6012)
* [rtc] use gmtime_r to replace gmtime
Diffstat (limited to 'components')
-rw-r--r--components/dfs/filesystems/elmfat/dfs_elm.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/components/dfs/filesystems/elmfat/dfs_elm.c b/components/dfs/filesystems/elmfat/dfs_elm.c
index eb57034061..adcb3e0ac5 100644
--- a/components/dfs/filesystems/elmfat/dfs_elm.c
+++ b/components/dfs/filesystems/elmfat/dfs_elm.c
@@ -944,22 +944,11 @@ DRESULT disk_ioctl(BYTE drv, BYTE ctrl, void *buff)
DWORD get_fattime(void)
{
DWORD fat_time = 0;
-
time_t now;
- struct tm *p_tm;
struct tm tm_now;
- /* get current time */
now = time(RT_NULL);
-
- /* lock scheduler. */
- rt_enter_critical();
- /* converts calendar time time into local time. */
- p_tm = gmtime(&now);
- /* copy the statically located variable */
- rt_memcpy(&tm_now, p_tm, sizeof(struct tm));
- /* unlock scheduler. */
- rt_exit_critical();
+ gmtime_r(&now, &tm_now);
fat_time = (DWORD)(tm_now.tm_year - 80) << 25 |
(DWORD)(tm_now.tm_mon + 1) << 21 |