Skip to content

Commit

Permalink
Merge pull request #21 from krayon/lgtm_fixes
Browse files Browse the repository at this point in the history
LGTM fixes
  • Loading branch information
krayon authored Jun 18, 2020
2 parents 2b692da + 3dca277 commit 3e1bc40
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 92 deletions.
9 changes: 3 additions & 6 deletions log.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#define max_src_len "16"

FILE *_logfile = NULL;
struct tm _timey;

/*
LOG LINE FORMAT:
Expand Down Expand Up @@ -61,16 +62,12 @@ void std_output(FILE *strm, const char *srcfile, const int line
char *nl; // new line ptr
va_list ap;
time_t t;
struct tm *tmp;

if (!strm) return;

t = time(NULL);
tmp = localtime(&t);
if (
tmp == NULL
|| strftime(_logtime, sizeof(_logtime), "%0Y%0m%0dT%0H%0M%0S%z", tmp) == 0
) {
localtime_r(&t, &_timey);
if (strftime(_logtime, sizeof(_logtime), "%0Y%0m%0dT%0H%0M%0S%z", &_timey) == 0) {
// "20140815T231613+1000"
snprintf(_logtime, 32, "===== UNKNOWN =====");
}
Expand Down
Loading

0 comments on commit 3e1bc40

Please sign in to comment.