Skip to content

Commit

Permalink
Merge pull request #210 from awslabs/release-101
Browse files Browse the repository at this point in the history
Release 1.0.1 (#208)
  • Loading branch information
disa6302 authored Sep 5, 2023
2 parents 0d94061 + d9318e2 commit 57637ea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,8 @@ PUBLIC_API STATUS generateTimestampStrInMilliseconds(PCHAR, PCHAR, UINT32, PUINT
// yyyy-mm-dd HH:MM:SS
#define MAX_TIMESTAMP_FORMAT_STR_LEN 26

#define MAX_MILLISECOND_PORTION_LENGTH 8
// Length = len (.) + len(sss) + len('\0')
#define MAX_MILLISECOND_PORTION_LENGTH 5

// Max timestamp string length including null terminator
#define MAX_TIMESTAMP_STR_LEN 17
Expand Down
2 changes: 1 addition & 1 deletion src/utils/src/Time.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ STATUS generateTimestampStrInMilliseconds(PCHAR formatStr, PCHAR pDestBuffer, UI
formattedStrLen = (UINT32) STRFTIME(pDestBuffer, destBufferLen - MAX_MILLISECOND_PORTION_LENGTH, formatStr, timeinfo);
CHK(formattedStrLen != 0, STATUS_STRFTIME_FALIED);
// Total length is 8 plus terminating null character. Generated string would have utmost size - 1. Hence need to add 1 to max length
SNPRINTF(pDestBuffer + formattedStrLen, MAX_MILLISECOND_PORTION_LENGTH + 1, ".%06d ", millisecondVal);
SNPRINTF(pDestBuffer + formattedStrLen, MAX_MILLISECOND_PORTION_LENGTH + 1, ".%03d ", millisecondVal);
formattedStrLen = (UINT32) STRLEN(pDestBuffer);
pDestBuffer[formattedStrLen] = '\0';
*pFormattedStrLen = formattedStrLen;
Expand Down
5 changes: 3 additions & 2 deletions src/utils/tst/FileLogger.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "UtilTestFixture.h"

// length of time and log level string in log: "2019-11-09 19:11:16.xxxxxx VERBOSE "
#define TIMESTRING_OFFSET 35
// length of time and log level string in log: "2019-11-09 19:11:16.xxx VERBOSE "
#define TIMESTRING_OFFSET 32

#ifdef _WIN32
#define TEST_TEMP_DIR_PATH (PCHAR) "C:\\Windows\\Temp\\"
Expand Down Expand Up @@ -41,6 +41,7 @@ TEST_F(FileLoggerTest, basicFileLoggerUsage)
FREMOVE(TEST_TEMP_DIR_PATH "kvsFileLog.0");
FREMOVE(TEST_TEMP_DIR_PATH "kvsFileLog.1");
FREMOVE(TEST_TEMP_DIR_PATH "kvsFileLog.2");
DLOGW("Testing log line");

createFileLogger(MIN_FILE_LOGGER_STRING_BUFFER_SIZE,
5,
Expand Down

0 comments on commit 57637ea

Please sign in to comment.