ip_addr_t *addr = (ip_addr_t *)os_zalloc(sizeof(ip_addr_t));
sntp_setservername(0, "us.pool.ntp.org"); // set server 0 by domain name
sntp_setservername(1, "ntp.sjtu.edu.cn"); // set server 1 by domain name
ipaddr_aton("210.72.145.44", addr);
sntp_setserver(2, addr); // set server 2 by IP address
sntp_set_timezone(+7); //Commenting this out uses UTC, We are PST +7
sntp_init();
os_free(addr);
When I call sntp_get_current_timestamp() it returns back that the time is now May 1st at 9:28:25 2019 but when submitting my value to my PHP script I use FROM_UNIXTIME() function to convert the big integer value passed to submit to my database it enters the value 2019-05-01 02:28:25 into the database, but when I view the data with Grafana all my timestamps are directly correct with the time taken and my system clock. Any MySQL and time guru's out there that can give me a tip on properly storing the UTC time. I don't want to have to deal with LEAPs and Day Light Savings time so I think the Universal TC is the way to go as the Unix timestamp considers those things..
Computer Clock reflects April 30 19:28:25
ESP reflects May 01 09:28:25
PHPMyadmin/MYSQL reads 2019-05-01 02:28:25 - Stores in SQL as a TIMESTAMP, SELECT @@system_time_zone; returns MST
Grafana Reads all times correct to reflect samples taken at the time of 19:28:25 on April 30 as they should
How should the ESP and PHP reflect the true data? Should the entries in my database READ as if I'm reading my local timezone or should there be an offset so it reflects the correct universal time but the DBadmin will see the times reflect in the future (As expected)
Thanks for any guidance!!