Просмотр исходного кода

musl/time.c RT_DEVICE_CTRL_RTC_GET_TIME 增加宏控

张世争 3 лет назад
Родитель
Сommit
2aabf1e497
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      components/libc/compilers/musl/time.c

+ 3 - 2
components/libc/compilers/musl/time.c

@@ -12,7 +12,8 @@
 #ifdef RT_USING_DEVICE
 int gettimeofday(struct timeval *tp, void *ignore)
 {
-    time_t time;
+    time_t time = 0;
+#ifdef RT_USING_RTC
     rt_device_t device;
 
     device = rt_device_find("rtc");
@@ -24,7 +25,7 @@ int gettimeofday(struct timeval *tp, void *ignore)
         tp->tv_sec = time;
         tp->tv_usec = 0;
     }
-
+#endif
     return time;
 }
 #endif