date docs & message fix

This commit is contained in:
rusefi 2017-08-23 00:46:34 -04:00
parent 1dac6d41ea
commit f2bd43ba71
3 changed files with 10 additions and 6 deletions

View File

@ -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
}

View File

@ -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);

View File

@ -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);
}