Skip to content

Don't use time values with 01.01.1970 for storing data #3838

@a-knust

Description

@a-knust

The Problem

In case the ntp-server is not reached directly after e.g. an unexpected automatic reboot the time is set to 01.01.1970 00:00:00. With this "invalid" time stamp all data graphs are useless (and following applications needs to handle "bad" input data), because there is a big gap between the actual time and the automatic generated initial time.

Version

v16.0.0 (Commit: f542d84)

Logfile

[0d00h00m00s] 1970-01-01T00:00:00	<INF>	[MAIN] =================================================
[0d00h00m00s] 1970-01-01T00:00:00	<INF>	[MAIN] ==================== Start ======================
[0d00h00m00s] 1970-01-01T00:00:00	<INF>	[MAIN] =================================================
[0d00h00m00s] 1970-01-01T00:00:00	<INF>	[SDCARD] Basic R/W check started...
[0d00h00m00s] 1970-01-01T00:00:00	<INF>	[SDCARD] Basic R/W check successful
[0d00h00m00s] 1970-01-01T00:00:00	<INF>	[MAIN] PSRAM size: 8388608 byte (8MB / 64MBit)
[0d00h00m00s] 1970-01-01T00:00:00	<INF>	[MAIN] Total heap: 4378411 byte
[0d00h00m03s] 1970-01-01T00:00:03	<INF>	[MAIN] Camera info: PID: 0x26, VER: 0x42, MIDL: 0x7f, MIDH: 0xa2
[0d00h00m03s] 1970-01-01T00:00:03	<INF>	[SNTP] TimeServer: 192.168.1.1
[0d00h00m03s] 1970-01-01T00:00:03	<INF>	[SNTP] Configuring NTP Client...
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[SNTP] Time zone set to CET-1CEST,M3.5.0,M10.5.0/3
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[SNTP] time zone: +0100 Delta to UTC: 3600 seconds
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[SNTP] The local time is unknown, starting with 1970-01-01 01:00:03
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[SNTP] Once the NTP server provides a time, we will switch to that one
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[MAIN] CPU frequency: 160 MHz
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[SDCARD] Folder/file presence check started...
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[SDCARD] Folder/file presence check successful
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[MAIN] Tag: 'v16.0.0', Release: v16.0.0 (Commit: f542d84), Date/Time: 2025-03-15 13:28, Web UI: Release: v16.0.0 (Commit: f542d84)
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[MAIN] Reset reason: Power-on event (or reset button)
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[WLANINI] SSID: xyz-4711
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[WLANINI] Password: XXXXXXXX
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[WLANINI] Hostname: Stromzaehler
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[WLANINI] RSSIThreshold: -75
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[MAIN] WLAN config loaded, init WIFI...
[0d00h00m03s] 1970-01-01T01:00:03	<INF>	[WIFI] Automatic interface config --> Use DHCP service
[0d00h00m03s] 1970-01-01T01:00:04	<INF>	[WIFI] Set hostname to: Stromzaehler
[0d00h00m03s] 1970-01-01T01:00:04	<INF>	[WIFI] Init successful
[0d00h00m06s] 1970-01-01T01:00:06	<INF>	[WIFI] Connected to: xyz-4711, RSSI: -65
[0d00h00m07s] 1970-01-01T01:00:07	<INF>	[WIFI] Assigned IP: 192.168.1.90
[0d00h00m23s] 1970-01-01T01:00:24	<INF>	[MAIN] Device info: CPU cores: 2, Chip revision: 300
[0d00h00m23s] 1970-01-01T01:00:24	<INF>	[MAIN] SD card info: Name: SC16G, Capacity: 15193MB, Free: 15156MB
[0d00h00m25s] 1970-01-01T01:00:26	<INF>	[MAIN] Initialization completed successfully
[0d00h00m28s] 1970-01-01T01:00:28	<INF>	[TFLITE] Trying to load the model. If it crashes here, it ist most likely due to a corrupted model!
[0d00h00m28s] 1970-01-01T01:00:28	<INF>	[LOGFILE] Set log level to ERROR

Expected Behavior

Use the time stamp from the last saved value as initial time stamp instead of the 01.01.1970 00:00:00. As you can see in the second screenshot (containing the stored data around the unexpected reboot) there is one value stored with the initial timestamp of 01.01.1970.

Screenshots

Image

Image

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions