From f4ac48ecd65136657f5cd9f2fcf057b42b92faf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Tue, 11 Jun 2019 11:37:12 +0100 Subject: [PATCH] Fix CurrentDateTime dropping microseconds (#1357) --- .../FreeRTOS_ESP32/ESP32_WROOM_32/nanoCLR/targetHAL_Time.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/FreeRTOS_ESP32/ESP32_WROOM_32/nanoCLR/targetHAL_Time.cpp b/targets/FreeRTOS_ESP32/ESP32_WROOM_32/nanoCLR/targetHAL_Time.cpp index 31ffd4d0e0..e93e72f99c 100644 --- a/targets/FreeRTOS_ESP32/ESP32_WROOM_32/nanoCLR/targetHAL_Time.cpp +++ b/targets/FreeRTOS_ESP32/ESP32_WROOM_32/nanoCLR/targetHAL_Time.cpp @@ -20,7 +20,7 @@ uint64_t HAL_Time_CurrentDateTime(bool datePartOnly) gettimeofday(&tv, NULL); // Convert from Unix time(year since 1900) to SYSTEMTIME(Years since 1601) - int64_t time = ((int64_t)tv.tv_sec * (int64_t)TIME_CONVERSION__TO_SECONDS) + TIME_UNIX_EPOCH_AS_TICKS; + int64_t time = ((int64_t)tv.tv_sec * (int64_t)TIME_CONVERSION__TO_SECONDS) + ((int64_t)tv.tv_usec * (int64_t)TIME_CONVERSION__TO_MILLISECONDS ) + TIME_UNIX_EPOCH_AS_TICKS; HAL_Time_ToSystemTime(time, &st );