-
I have a question regarding formatting timestamps in trice log, the documentation demonstrates only a few cases here and it is not clear to me what the possibilities are. As 32-bit timestamp, I want to use a date time, which is If I try to use
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Using 1 second as 32-bit timestamp unit, is, maybe, unnecessary overhead. The Trices arrive typically within 100ms or less at the host side, so the host timestamps could be ok for what you want and they are already formatted the way you want. And your target does not need to handle timestamps at all then. It is possible to extend the Trice tool with a
-ts string
Target timestamp general format string at start of each line, if target timestamps existent (configured). Choose between "µs" (or "us") and "ms", use "" or 'off' or 'none' to suppress existing target timestamps. Sets ts0, ts16, ts32 if these not passed. If several trices form a log line only the timestamp of first trice ist displayed. (default "µs") Also you write The error you showed, seems to have a different root cause. Please share the line 41 from file.c. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the explanation @dAxi-flw6 - this use case I did not have in my mind before.
What you see with The values ms@Mac Src % date +"%s"
1749932858
ms@Mac Src % date -r 1749932858
Sa 14 Jun 2025 22:27:38 CEST
ms@Mac Src % It is possible to add the option EDIT: If you plan to produce devices valid beyond 2038, we need to handle that correctly. |
Beta Was this translation helpful? Give feedback.
Using 1 second as 32-bit timestamp unit, is, maybe, unnecessary overhead. The Trices arrive typically within 100ms or less at the host side, so the host timestamps could be ok for what you want and they are already formatted the way you want. And your target does not need to handle timestamps at all then.
It is possible to extend the Trice tool with a
-ts YMDHMS
option to convert seconds into date and time. But that would have the impact, that your target knows the exact second count since 1970-01-01-00-00-00. I do not think, that this makes some sense.-ts32 s
is an invalid usage. See thistrice help -log
output snippet: