Skip to content

Commit be7005d

Browse files
authored
Merge pull request #750 from michael-dwan/fix/Issue-749_build_errors_in_older_clangs
unity_internals: Update UNITY_PRINT_EXEC_TIME for older versions of clang
2 parents 3ad685c + 5afafc4 commit be7005d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/unity_internals.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,13 +426,13 @@ typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
426426
#define UNITY_GET_TIME(t) clock_gettime(CLOCK_MONOTONIC, &t)
427427
#define UNITY_EXEC_TIME_START() UNITY_GET_TIME(Unity.CurrentTestStartTime)
428428
#define UNITY_EXEC_TIME_STOP() UNITY_GET_TIME(Unity.CurrentTestStopTime)
429-
#define UNITY_PRINT_EXEC_TIME() { \
430-
UNITY_UINT execTimeMs = ((Unity.CurrentTestStopTime.tv_sec - Unity.CurrentTestStartTime.tv_sec) * 1000L); \
431-
execTimeMs += ((Unity.CurrentTestStopTime.tv_nsec - Unity.CurrentTestStartTime.tv_nsec) / 1000000L); \
429+
#define UNITY_PRINT_EXEC_TIME() do { \
430+
UNITY_UINT execTimeMs = (UNITY_UINT)((Unity.CurrentTestStopTime.tv_sec - Unity.CurrentTestStartTime.tv_sec) * 1000L); \
431+
execTimeMs += (UNITY_UINT)((Unity.CurrentTestStopTime.tv_nsec - Unity.CurrentTestStartTime.tv_nsec) / 1000000L); \
432432
UnityPrint(" ("); \
433433
UnityPrintNumberUnsigned(execTimeMs); \
434434
UnityPrint(" ms)"); \
435-
}
435+
} while(0)
436436
#endif
437437
#endif
438438
#endif

0 commit comments

Comments
 (0)