Prechádzať zdrojové kódy

musl/time.c RT_DEVICE_CTRL_RTC_GET_TIME 增加宏控

张世争 3 rokov pred
rodič
commit
2aabf1e497
1 zmenil súbory, kde vykonal 3 pridanie a 2 odobranie
  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
 #ifdef RT_USING_DEVICE
 int gettimeofday(struct timeval *tp, void *ignore)
 int gettimeofday(struct timeval *tp, void *ignore)
 {
 {
-    time_t time;
+    time_t time = 0;
+#ifdef RT_USING_RTC
     rt_device_t device;
     rt_device_t device;
 
 
     device = rt_device_find("rtc");
     device = rt_device_find("rtc");
@@ -24,7 +25,7 @@ int gettimeofday(struct timeval *tp, void *ignore)
         tp->tv_sec = time;
         tp->tv_sec = time;
         tp->tv_usec = 0;
         tp->tv_usec = 0;
     }
     }
-
+#endif
     return time;
     return time;
 }
 }
 #endif
 #endif