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

@ -2,12 +2,12 @@
#define HASP_LANG_H #define HASP_LANG_H
#ifndef HASP_LANGUAGE #ifndef HASP_LANGUAGE
#include "en_US.h" #include "en_US.h"
#else #else
#define QUOTEME(x) QUOTEME_1(x) #define QUOTEME(x) QUOTEME_1(x)
#define QUOTEME_1(x) #x #define QUOTEME_1(x) #x
#define INCLUDE_FILE(x) QUOTEME(x.h) #define INCLUDE_FILE(x) QUOTEME(x.h)
#include INCLUDE_FILE(HASP_LANGUAGE) #include INCLUDE_FILE(HASP_LANGUAGE)
#endif #endif
// language independent defines // language independent defines
@ -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