mg_time() gets updated to a very large number after an SNTP reply, which results in an overflow when converting from double to long. Using mgos_uptime() instead should fix this.
not only that, but according to docs millis and micros are supposed to return uptime, not wall time.
i'll integrate this fix into our repo
thanks @cullenfj !
mg_time() gets updated to a very large number after an SNTP reply, which results in an overflow when converting from double to long. Using mgos_uptime() instead should fix this.