From e72bf87ac8867308077a147da36025edf6bb05eb Mon Sep 17 00:00:00 2001 From: LuChiChick <1084116302@qq.com> Date: Fri, 8 Aug 2025 09:38:53 +0800 Subject: [PATCH] fix different timescale (s/ms/us) --- SNOOPerToCSV.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/SNOOPerToCSV.cpp b/SNOOPerToCSV.cpp index 7f85658..5d3cecd 100644 --- a/SNOOPerToCSV.cpp +++ b/SNOOPerToCSV.cpp @@ -269,10 +269,17 @@ int main(int argc, char *argv[]) { double time = 0.0; sscanf(time_str, "%lf", &time); - timestamp += time / (1000 * 1000); + + // 处理时间戳 + if (strstr(time_str, "us")) + timestamp += time / (1000 * 1000); + else if (strstr(time_str, "ms")) + timestamp += time / (1000); + else if (strstr(time_str, "s")) + timestamp += time; } - printf("timestamp: %lf %s\n", timestamp, segment_buffer); + printf("timestamp: %lfs %s\n", timestamp, segment_buffer); // 处理数值链表 value_node *target_value_node = value_list_head;