In order to do a project that includes data from PySense, I need to attach to that data a way to associate a time and date. However, it is showing me a date from 1970 and the time starts at 00:00:00.
How do I get the real time and date?
What I found online:
current_time = utime.localtime()
timestamp = "{:04}-{:02}-{:02} {:02}:{:02}:{:02}".format(current_time[0], current_time[1],
current_time[2], current_time[3], current_time[4], current_time[5])
print("Timestamp: {}".format(timestamp))
This method uses the utime lib. However, the output I'm getting after running the code is like this:
Timestamp: 1970-01-01 00:04:40
Temperature: 22.96 C
Humidity: 62.90 %
Light: 42 lux
which is not the real data.
PS. This is a program that is supposed to run on a LoPy4 from Pycom board company.