The customer requested a solution on Unix time, where systemd prevented that the system date started since 01-01-1970.
However, the proposed solution above introduced a new problem on lttng. When using lttng to view traces, it reports the following errors:
[error] ctf_clock_declaration_visit: unexpected unary expression for clock offset
[error] ctf_visitor_construct_metadata: clock declaration error
[error] Error in CTF metadata constructor -22
[warning] Unable to open trace metadata for path "/tmp/csrpTrace/trace/ust/uid/0/32-bit".
[warning] [Context] Cannot open_trace of format ctf at path /tmp/csrpTrace/trace/ust/uid/0/32-bit.
[warning] [Context] cannot open trace "/tmp/csrpTrace/trace/ust/uid/0/32-bit" from /tmp/csrpTrace/trace for reading.
[error] Cannot open any trace for reading.
[error] opening trace "/tmp/csrpTrace/trace" for reading.
[error] none of the specified trace paths could be opened.
 
In the lttng file "metadata", offset of clock is negative:
clock
{ name = "monotonic"; uuid = "f18ef9e3-93fb-432b-bd8c-2c0da378d22c"; description = "Monotonic Clock"; freq = 1000000000; /* Frequency, in Hz */ /* clock value offset from Epoch is: offset * (1/freq) */ offset = -40; }
;
 
This is with lttng version 2.9.5
The customer suggest the following patch may be useful:
https://lists.lttng.org/pipermail/lttng-dev/2016-February/025487.html