1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-21 21:22:31 +03:00

core: fix bug in gettimeofday

gettimeofday used to return timestamps which had tv_sec 1000 times smaller than the correct value.
s_bootTime is in seconds, so no need to divide it by 1000.
This commit is contained in:
Ivan Grokhotkov
2016-08-25 12:51:57 +08:00
parent 35ee060c09
commit 7f6e0c98f6

View File

@ -97,7 +97,7 @@ int _gettimeofday_r(struct _reent* unused, struct timeval *tp, void *tzp)
if (tp) if (tp)
{ {
ensureBootTimeIsSet(); ensureBootTimeIsSet();
tp->tv_sec = (s_bootTime + millis()) / 1000; tp->tv_sec = s_bootTime + millis() / 1000;
tp->tv_usec = micros() * 1000; tp->tv_usec = micros() * 1000;
} }
return 0; return 0;