diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index cfecb6740d..2543b17d22 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -1261,6 +1261,7 @@ static void setValue(const char *paramStr, const char *valueStr) { engineConfiguration->targetVBatt = valueF; #if EFI_RTC || defined(__DOXYGEN__) } else if (strEqualCaseInsensitive(paramStr, "date")) { + // rusEfi console invokes this method with timestamp in local timezone setDateTime(valueStr); #endif } diff --git a/firmware/hw_layer/rtc_helper.cpp b/firmware/hw_layer/rtc_helper.cpp index 8e70ea08bc..f6701ba916 100644 --- a/firmware/hw_layer/rtc_helper.cpp +++ b/firmware/hw_layer/rtc_helper.cpp @@ -78,6 +78,9 @@ static void put2(int offset, char *lcd_str, int value) { } } +/** + * @return true if we seem to know current date, false if no valid RTC state + */ bool dateToStringShort(char *lcd_str) { #if EFI_RTC || defined(__DOXYGEN__) strcpy(lcd_str, "0000_000000\0"); @@ -88,9 +91,9 @@ bool dateToStringShort(char *lcd_str) { lcd_str[0] = 0; return false; } - put2(0, lcd_str, timp.tm_mon + 1); - put2(2, lcd_str, timp.tm_mday); - put2(5, lcd_str, timp.tm_hour); + put2(0, lcd_str, timp.tm_mon + 1); // months since January 0-11 + put2(2, lcd_str, timp.tm_mday); // day of the month 1-31 + put2(5, lcd_str, timp.tm_hour); // hours since midnight 0-23 put2(7, lcd_str, timp.tm_min); put2(9, lcd_str, timp.tm_sec); @@ -136,7 +139,7 @@ void printDateTime(void) { date_get_tm(&timp); appendMsgPrefix(&logger); - appendPrintf(&logger, "Current RTC time in GMT is: %04u-%02u-%02u %02u:%02u:%02u", timp.tm_year + 1900, timp.tm_mon + 1, timp.tm_mday, timp.tm_hour, + appendPrintf(&logger, "Current RTC localtime is: %04u-%02u-%02u %02u:%02u:%02u", timp.tm_year + 1900, timp.tm_mon + 1, timp.tm_mday, timp.tm_hour, timp.tm_min, timp.tm_sec); appendMsgPostfix(&logger); scheduleLogging(&logger); diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index 12683170f7..c477e91b30 100644 --- a/java_console/ui/src/com/rusefi/Launcher.java +++ b/java_console/ui/src/com/rusefi/Launcher.java @@ -229,8 +229,8 @@ public class Launcher { setTitle(); UiUtils.trueRepaint(tabbedPane); // this would repaint status label if (ConnectionStatus.INSTANCE.getValue() == ConnectionStatus.Value.CONNECTED) { - long unixTime = System.currentTimeMillis() / 1000L; - long withOffset = unixTime + TimeZone.getDefault().getOffset(System.currentTimeMillis()) / 1000; + long unixGmtTime = System.currentTimeMillis() / 1000L; + long withOffset = unixGmtTime + TimeZone.getDefault().getOffset(System.currentTimeMillis()) / 1000; CommandQueue.getInstance().write("set date " + withOffset, CommandQueue.DEFAULT_TIMEOUT, InvocationConfirmationListener.VOID, false); }