I need to get the date and time from the local blynk server.
but the date and time are wrong, returns the year 1970.
• Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
• Blynk local server
• Blynk Library version 0.6.1
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
#define W5100_CS 10
#define SDCARD_CS 4
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "My auth KEY";
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(currentTime);
Serial.print(" ");
Serial.print(currentDate);
Serial.println();
// Send time to the App
Blynk.virtualWrite(V1, currentTime);
// Send date to the App
Blynk.virtualWrite(V2, currentDate);
}
BLYNK_CONNECTED() {
// Synchronize time on connection
rtc.begin();
}
void setup()
{
// Debug console
Serial.begin(9600);
pinMode(SDCARD_CS, OUTPUT);
digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
Blynk.begin(auth, "MYDNSNAMESERVER", 8080);
// Other Time library functions can be used, like:
// timeStatus(), setSyncInterval(interval)...
// Read more: http://www.pjrc.com/teensy/td_libs_Time.html
setSyncInterval(10 * 1); // Sync interval in seconds (10 minutes)
// Display digital clock every 10 seconds
timer.setInterval(1000L, clockDisplay);
}
void loop()
{
Blynk.run();
timer.run();
}