I have a node app running on a Comfile Pi, which is a RPi Compute Module 3 mounted in the back of a touch screen interface.
I'm gathering and storing data using MongoDB, which is running in the background as a service. On each document that I insert, I call the new Date(<"YYYY-mm-ddThh:MM:ss">)
method to get the current date down to the second.
My system clock is correctly updated, but the Date method is returning the Unix Epoch (or very close to it) every time I store a new document.
Now, I've also used the library moment to store dates, but Mongo didn't seem to sort those correctly. Moment would correctly capture the updated time and date.
Is this an issue with Mongo itself? My clock takes several seconds to update every time on boot. Could Mongo be starting before this happens and starting with the wrong time info? Could it simply be an issue with the Pi itself? I'm fairly lost.
Further info: Normal ways of updating this Pi's clock didn't work for me. The only way I was able to make it function was the following console command:
Sudo timedatectl set-ntp True
Thanks for any guidance.