RTC exemple error compiling esp32

hi, i try RTC example from " exemple RTC esp32 " but my arduino ide give me an error, or more.
i want esp32 works like a RTC and update date and time when it connected to server NTP .
thanks for help me

the code is this

Download latest Blynk library here:

Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.

  Downloads, docs, tutorials: http://www.blynk.cc
  Sketch generator:           http://examples.blynk.cc
  Blynk community:            http://community.blynk.cc
  Follow us:                  http://www.fb.com/blynkapp

Blynk library is licensed under MIT license
This example code is in public domain.


Blynk can provide your device with time data, like an RTC.
Please note that the accuracy of this method is up to several seconds.

App project setup:
  RTC widget (no pin required)
  Value Display widget on V1
  Value Display widget on V2

For this example you'll need Time keeping library:

This code is based on an example from the Time library:

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <TimeLib.h>
#include <WidgetRTC.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "dda232c8fd3a48789e674cb780bea925";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ASUS";
char pass[] = "YourPassword";

BlynkTimer timer;

WidgetRTC rtc;

// Digital clock display of the time
void clockDisplay()
// You can call hour(), minute(), ... at any time
// Please see Time library examples for details

String currentTime = String(hour()) + ":" + minute() + ":" + second();
String currentDate = String(day()) + " " + month() + " " + year();
Serial.print("Current time: ");
Serial.print(" ");

// Send time to the App
Blynk.virtualWrite(V1, currentTime);
// Send date to the App
Blynk.virtualWrite(V2, currentDate);

void setup()
// Debug console

Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

// Begin synchronizing time

// Other Time library functions can be used, like:
//   timeStatus(), setSyncInterval(interval)...
// Read more: http://www.pjrc.com/teensy/td_libs_Time.html

// Display digital clock every 10 seconds
timer.setInterval(10000L, clockDisplay);

void loop()

and arduino ide give me this

Arduino:1.8.9 (Windows 10), Scheda:"ESP32 Dev Module, Disabled, Default, QIO, 80MHz, 4MB (32Mb), 921600, None"

C:\Users\steti\Documents\Arduino\libraries\Time-master\DateStrings.cpp: In function 'char* monthStr(uint8_t)':

C:\Users\steti\Documents\Arduino\libraries\Time-master\DateStrings.cpp:76:66: error: 'strcpy_P' was not declared in this scope

   strcpy_P(buffer, (PGM_P)pgm_read_word(&(monthNames_P[month])));


C:\Users\steti\Documents\Arduino\libraries\Time-master\DateStrings.cpp: In function 'char* dayStr(uint8_t)':

C:\Users\steti\Documents\Arduino\libraries\Time-master\DateStrings.cpp:90:61: error: 'strcpy_P' was not declared in this scope

  strcpy_P(buffer, (PGM_P)pgm_read_word(&(dayNames_P[day])));


Più di una libreria trovata per "WiFi.h"
Usata: C:\Users\steti\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\WiFi
Non usata: C:\Users\steti\Documents\Arduino\libraries\WiFiNINA
Non usata: C:\Program Files (x86)\Arduino\libraries\WiFi
exit status 1
Errore durante la compilazione per la scheda ESP32 Dev Module.

You seem to be using your ESP32 with an Ethernet connection method, which is a new one on me.
Maybe you should post your full code.


1 Like

Thanks for help me. I add more information in first post

Is this the version of the Time library that you have installed?



Okay, the code compiles correctly for me, but I have two versions of the Time library installed on my PC.

Multiple libraries were found for "TimeLib.h"
 Used: C:\Users\Pete Knight\Documents\Arduino\libraries\Time
 Not used: C:\Users\Pete Knight\Documents\Arduino\libraries\Time-master
Multiple libraries were found for "WiFi.h"
 Used: C:\Users\Pete Knight\Documents\Arduino\hardware\espressif\esp32\libraries\WiFi
 Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
Using library WiFi at version 1.0 in folder: C:\Users\Pete Knight\Documents\Arduino\hardware\espressif\esp32\libraries\WiFi 
Using library Blynk at version 0.6.1 in folder: C:\Users\Pete Knight\Documents\Arduino\libraries\Blynk 
Using library Time at version 1.5 in folder: C:\Users\Pete Knight\Documents\Arduino\libraries\Time 
"C:\\Users\\Pete Knight\\Documents\\Arduino\\hardware\\espressif\\esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-size" -A "C:\\Users\\PETEKN~1\\AppData\\Local\\Temp\\arduino_build_921506/sketch_jul06a.ino.elf"
Sketch uses 520858 bytes (39%) of program storage space. Maximum is 1310720 bytes.
Global variables use 38148 bytes (12%) of dynamic memory, leaving 256764 bytes for local variables. Maximum is 294912 bytes.

Your compiler is choosing to use the library that sits here on your system:

As you can see from my compiler output, the one that my compiler is using isn’t called “Time-master”, its simply called “Time” and it’s version 1.5 of the library.

You first of all need to check that you do actually have the correct library installed, and that it’s up to date (v1.5.0 Installed). Do this via Sketch/Include Library/Manage Libraries:

You then need to move the library at C:\Users\steti\Documents\Arduino\libraries\Time-master\ to a place where the Arduino IDE cant see it (renaming it wont work), so move it to your desktop, or delete it entirely.
Re-compiling your code should then work correctly.


1 Like

it’s work!!! thank you so much Pete…sorry for me, but i’m new. i would like to learn programming , can you give me some advice?

1 Like

I’d suggest finding a youtube channel that suits your particular style of learning, probably in your native language (Italian?), and follow some of the tutorials.
You’ll probably find that there are more channels limit there that use the ESP8266 for this type of tutorial, and that would be the type of device I’d start with.


This helped me a lot

1 Like