]> granicus.if.org Git - esp-idf/commitdiff
newlib: fix compilation error when no timers are enabled in menuconfig
authorIvan Grokhotkov <ivan@espressif.com>
Fri, 4 Nov 2016 02:55:25 +0000 (10:55 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Fri, 4 Nov 2016 02:55:25 +0000 (10:55 +0800)
components/newlib/time.c

index 5f60e1d7b2bd585f16fd5a15330f1eb15ba1bb8d..a474f1ca33a17eace03d94708fe93e0ca017bd1f 100644 (file)
@@ -55,14 +55,16 @@ static uint64_t get_rtc_time_us()
 #endif // WITH_RTC
 
 
-// time from Epoch to the first boot time
+// s_boot_time: time from Epoch to the first boot time
 #ifdef WITH_RTC
 static RTC_DATA_ATTR struct timeval s_boot_time;
-#else
+#elif defined(WITH_FRC1)
 static struct timeval s_boot_time;
 #endif
-static _lock_t s_boot_time_lock;
 
+#if defined(WITH_RTC) || defined(WITH_FRC1)
+static _lock_t s_boot_time_lock;
+#endif
 
 #ifdef WITH_FRC1
 #define FRC1_PRESCALER 16
@@ -121,6 +123,7 @@ clock_t IRAM_ATTR _times_r(struct _reent *r, struct tms *ptms)
     return (clock_t) tv.tv_sec;
 }
 
+#if defined( WITH_FRC1 ) || defined( WITH_RTC )
 static uint64_t get_time_since_boot()
 {
     uint64_t microseconds = 0;
@@ -140,6 +143,7 @@ static uint64_t get_time_since_boot()
 #endif
     return microseconds;
 }
+#endif // defined( WITH_FRC1 ) || defined( WITH_RTC )
 
 int IRAM_ATTR _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
 {
@@ -176,7 +180,7 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz)
     }
     return 0;
 #else
-    __errno_r(r) = ENOSYS;
+    errno = ENOSYS;
     return -1;
 #endif
 }