diff --git a/src/logger.c b/src/logger.c index e2f8418..2eb48e8 100644 --- a/src/logger.c +++ b/src/logger.c @@ -59,17 +59,18 @@ static const char *log_level_names[LOG_MAX_LEVEL] = { static inline void logger_log_set_color(logger_t *ctx, const char *color) { +#if !defined(__BARE_METAL__) size_t ret, len; if (ctx->flags & LOGGER_FLAG_NO_COLORS) return; - if (ctx->file && isatty(fileno(ctx->file))) { len = strnlen(color, 8); ret = write(fileno(ctx->file), color, len); assert(ret == len); ARG_UNUSED(ret); /* squash warning in Release builds */ } +#endif } static const char *get_tstamp() diff --git a/src/utils.c b/src/utils.c index 272cd38..dc103ac 100644 --- a/src/utils.c +++ b/src/utils.c @@ -148,6 +148,29 @@ int add_iso8601_utc_datetime(char *buf, size_t size) return strftime(buf, size, "%Y-%m-%dT%H:%M:%SZ", &timeinfo); } +#elif defined(__BARE_METAL__) + +struct timeval { + long tv_sec; // seconds since epoch + long tv_usec; // microseconds +}; + +struct timezone { + int tz_minuteswest; // minutes west of UTC + int tz_dsttime; // daylight saving time flag +}; + +int gettimeofday(struct timeval * tp, struct timezone * tzp) +{ + tp->tv_sec = 0; + tp->tv_usec = 0; + return 0; +} + +int add_iso8601_utc_datetime(char* buf, size_t size) { + return 0; +} + #else #error Platform test failed