Add D_TIMESTAMP to lang.h

This commit is contained in:
fvanroie 2021-05-06 18:30:15 +02:00
parent 55d45f29c8
commit 8fbab678b3
2 changed files with 11 additions and 8 deletions

View File

@ -66,7 +66,7 @@ static void debugPrintTimestamp(int level, Print* _logOutput)
unsigned long int milli = curTime.tv_usec / 1000; unsigned long int milli = curTime.tv_usec / 1000;
char buffer[24]; char buffer[24];
// strftime(buffer, sizeof(buffer), "[%b %d %H:%M:%S", timeinfo); // Literal String // strftime(buffer, sizeof(buffer), "[%b %d %H:%M:%S", timeinfo); // Literal String
strftime(buffer, sizeof(buffer), "[%H:%M:%S", timeinfo); // Literal String strftime(buffer, sizeof(buffer), "[" D_TIMESTAMP, timeinfo); // Literal String
#ifdef ARDUINO #ifdef ARDUINO
_logOutput->printf(PSTR("%s.%03lu]"), buffer, milli); _logOutput->printf(PSTR("%s.%03lu]"), buffer, milli);
@ -78,9 +78,9 @@ static void debugPrintTimestamp(int level, Print* _logOutput)
uint32_t msecs = millis(); uint32_t msecs = millis();
#ifdef ARDUINO #ifdef ARDUINO
_logOutput->printf(PSTR("[%15d.%03d]"), msecs / 1000, msecs % 1000); _logOutput->printf(PSTR("[" D_TIME_MILLIS ".%03d]"), msecs / 1000, msecs % 1000);
#else #else
debug_print(_logOutput, PSTR("[%15d.%03d]"), msecs / 1000, msecs % 1000); debug_print(_logOutput, PSTR("[" D_TIME_MILLIS ".%03d]"), msecs / 1000, msecs % 1000);
#endif #endif
} }
} }

View File

@ -15,4 +15,7 @@
#define D_BULLET " * " #define D_BULLET " * "
#define D_MANUFACTURER "openHASP" #define D_MANUFACTURER "openHASP"
#define D_TIMESTAMP "%H:%M:%S" // Used when reference time is set from NTP
#define D_TIME_MILLIS "%8d" // Used when no reference clock could be set
#endif #endif