Explorar el Código

[libc][time] solve the problem which the os tick can be calculated wrongly because the local variable was not initialized.

chunyexixiaoyu hace 2 años
padre
commit
37d0be3290
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      components/libc/compilers/common/time.c

+ 1 - 1
components/libc/compilers/common/time.c

@@ -689,7 +689,7 @@ int rt_timespec_to_tick(const struct timespec *time)
 {
 {
     int tick;
     int tick;
     int nsecond, second;
     int nsecond, second;
-    struct timespec tp;
+    struct timespec tp = {0};
 
 
     RT_ASSERT(time != RT_NULL);
     RT_ASSERT(time != RT_NULL);