From ecca21fd40be21164d664eb7d8a52ea1fdabfde0 Mon Sep 17 00:00:00 2001 From: Sebastian Unger Date: Thu, 13 Jun 2019 13:41:12 +0200 Subject: Add user custom timestamp interface Two new macros are introduced so that users can use their customized timestamps for DLT messages: - DLT_LOG_TS(CONTEXT, LOGLEVEL, TS, ARGS ...) - DLT_LOG_ID_TS(CONTEXT, LOGLEVEL, MSGID, TS, ARGS ...) Detailed explanations can be found in dlt_for_developers.md. Also a new option is added to dlt-system to use events' timestamps from journald adapter. Signed-off-by: Sebastian Unger --- tests/gtest_dlt_user.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') diff --git a/tests/gtest_dlt_user.cpp b/tests/gtest_dlt_user.cpp index 777e459..48be5ef 100644 --- a/tests/gtest_dlt_user.cpp +++ b/tests/gtest_dlt_user.cpp @@ -451,6 +451,26 @@ TEST(t_dlt_user_log_write_finish, finish) EXPECT_LE(DLT_RETURN_OK, dlt_unregister_app()); } +/*/////////////////////////////////////// */ +/* t_dlt_user_log_write_finish */ +TEST(t_dlt_user_log_write_finish, finish_with_timestamp) +{ + DltContext context; + DltContextData contextData; + + EXPECT_LE(DLT_RETURN_OK, dlt_register_app("TUSR", "dlt_user.c tests")); + EXPECT_LE(DLT_RETURN_OK, dlt_register_context(&context, "TEST", "dlt_user.c t_dlt_user_log_write_finish finish")); + + /* finish with start and initialized context */ + EXPECT_LE(DLT_RETURN_OK, dlt_user_log_write_start(&context, &contextData, DLT_LOG_DEFAULT)); + contextData.use_timestamp = DLT_USER_TIMESTAMP; + contextData.user_timestamp = UINT32_MAX; + EXPECT_LE(DLT_RETURN_OK, dlt_user_log_write_finish(&contextData)); + + EXPECT_LE(DLT_RETURN_OK, dlt_unregister_context(&context)); + EXPECT_LE(DLT_RETURN_OK, dlt_unregister_app()); +} + /*/////////////////////////////////////// */ /* t_dlt_user_log_write_bool */ TEST(t_dlt_user_log_write_bool, normal) -- cgit v1.2.1