+static
+int get_timeout(struct timespec *constructor_timeout)
+{
+ struct timespec constructor_delay =
+ {
+ .tv_sec = LTTNG_UST_DEFAULT_CONSTRUCTOR_TIMEOUT_S,
+ .tv_nsec = LTTNG_UST_DEFAULT_CONSTRUCTOR_TIMEOUT_NS,
+ };
+ struct timespec realtime;
+ int ret;
+
+ ret = clock_gettime(CLOCK_REALTIME, &realtime);
+ if (ret)
+ return ret;
+
+ constructor_timeout->tv_sec =
+ realtime.tv_sec + constructor_delay.tv_sec;
+ constructor_timeout->tv_nsec =
+ constructor_delay.tv_nsec + realtime.tv_nsec;
+ if (constructor_timeout->tv_nsec >= 1000000000UL) {
+ constructor_timeout->tv_sec++;
+ constructor_timeout->tv_nsec -= 1000000000UL;
+ }
+ return 0;
+}