Skip to content

Commit cfb5aee

Browse files
committed
Backwards compatibility for older AVR core versions
They do not have time.h
1 parent 0a51282 commit cfb5aee

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/WiFi.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@
1717
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1818
*/
1919

20+
#if defined(ARDUINO_ARCH_AVR) && (__AVR_LIBC_MAJOR__ < 2)
21+
#define WIFI_101_NO_TIME_H
22+
#endif
23+
24+
#ifndef WIFI_101_NO_TIME_H
2025
#include <time.h>
26+
#endif
2127

2228
#include "WiFi101.h"
2329

@@ -912,6 +918,9 @@ int WiFiClass::ping(IPAddress host, uint8_t ttl)
912918

913919
uint32_t WiFiClass::getTime()
914920
{
921+
#ifdef WIFI_101_NO_TIME_H
922+
return 0;
923+
#else
915924
tstrSystemTime systemTime;
916925

917926
_resolve = (uint32_t)&systemTime;
@@ -946,6 +955,7 @@ uint32_t WiFiClass::getTime()
946955
}
947956

948957
return t;
958+
#endif
949959
}
950960

951961
WiFiClass WiFi;

0 commit comments

Comments
 (0)