+ union lttng_timespec *lts = (union lttng_timespec *) &ts;
+
+ clock_gettime(ust_clock_source, &ts);
+ /*
+ * Clock source can change when loading the binary (tracectl.c)
+ * so we must check if the clock source has changed before
+ * returning the correct value
+ */
+ if (likely(ust_clock_source == CLOCK_TRACE)) {
+ retval = lts->lttng_ts;
+ } else { /* CLOCK_MONOTONIC */
+ retval = ts.tv_sec;
+ retval *= 1000000000;
+ retval += ts.tv_nsec;
+ }