Move time utils to their own time.c file
[lttng-tools.git] / src / common / utils.c
index 08139e5e2cb23d691c92c6800cef841e2362bc57..3dc2d9297d4379ee99a6e127b17a84748dbf15de 100644 (file)
@@ -1646,38 +1646,3 @@ int utils_show_help(int section, const char *page_name,
 end:
        return ret;
 }
-
-LTTNG_HIDDEN
-int timespec_to_ms(struct timespec ts, unsigned long *ms)
-{
-       unsigned long res, remain_ms;
-
-       if (ts.tv_sec > ULONG_MAX / MSEC_PER_SEC) {
-               errno = EOVERFLOW;
-               return -1;      /* multiplication overflow */
-       }
-       res = ts.tv_sec * MSEC_PER_SEC;
-       remain_ms = ULONG_MAX - res;
-       if (ts.tv_nsec / NSEC_PER_MSEC > remain_ms) {
-               errno = EOVERFLOW;
-               return -1;      /* addition overflow */
-       }
-       res += ts.tv_nsec / NSEC_PER_MSEC;
-       *ms = res;
-       return 0;
-}
-
-LTTNG_HIDDEN
-struct timespec timespec_abs_diff(struct timespec t1, struct timespec t2)
-{
-       uint64_t ts1 = (uint64_t) t1.tv_sec * (uint64_t) NSEC_PER_SEC +
-                       (uint64_t) t1.tv_nsec;
-       uint64_t ts2 = (uint64_t) t2.tv_sec * (uint64_t) NSEC_PER_SEC +
-                       (uint64_t) t2.tv_nsec;
-       uint64_t diff = max(ts1, ts2) - min(ts1, ts2);
-       struct timespec res;
-
-       res.tv_sec = diff / (uint64_t) NSEC_PER_SEC;
-       res.tv_nsec = diff % (uint64_t) NSEC_PER_SEC;
-       return res;
-}
This page took 0.024348 seconds and 4 git commands to generate.