Closed
Description
Basic Infos
Hardware
Hardware: ESP-12E
Core Version: 2.1.0-rc2
Description
"Internal" time.c functions always return 0 /1970-01-01/ if not synced via NTP.
I want to initialize internal clock via constant or from RTC for log timestamping (so I don't need precise time on startup, but valid measured intervals)
Settings in IDE
Module: Generic ESP8266 Module
Flash Size: 4MB
CPU Frequency: 80Mhz
Flash Mode: qio
Flash Frequency: 80Mhz
Upload Using: SERIAL
Reset Method: ck
Sketch
#include <Arduino.h>
#include <time.h>
void setup() {
// WiFi.begin(); // wifi disabled for example
// configTime(3*3600, 0, "not.avail.ntp");
Serial.begin(115200);
}
void loop() {
time_t now = time(nullptr);
Serial.println(ctime(&now));
delay(1000);
}
Debug Messages
Thu Jan 01 00:00:00 1970
Thu Jan 01 00:00:00 1970
...
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.