Sha256: 6c222065caabff6e3b2f9e4f9a2098a89df96ee2d7dfecb0e57341fc12d9345b

Contents?: true

Size: 508 Bytes

Versions: 9

Compression:

Stored size: 508 Bytes

Contents

#include <errno.h>
#include <time.h>

#include "ruby_helpers.h"
#include "time_helpers.h"

// Safety: This function is assumed never to raise exceptions by callers when raise_on_failure == false
long monotonic_wall_time_now_ns(bool raise_on_failure) {
  struct timespec current_monotonic;

  if (clock_gettime(CLOCK_MONOTONIC, &current_monotonic) != 0) {
    if (raise_on_failure) ENFORCE_SUCCESS_GVL(errno);
    return 0;
  }

  return current_monotonic.tv_nsec + SECONDS_AS_NS(current_monotonic.tv_sec);
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ddtrace-1.12.1 ext/ddtrace_profiling_native_extension/time_helpers.c
ddtrace-1.12.0 ext/ddtrace_profiling_native_extension/time_helpers.c
ddtrace-1.11.1 ext/ddtrace_profiling_native_extension/time_helpers.c
ddtrace-1.11.0 ext/ddtrace_profiling_native_extension/time_helpers.c
ddtrace-1.11.0.beta1 ext/ddtrace_profiling_native_extension/time_helpers.c
ddtrace-1.10.1 ext/ddtrace_profiling_native_extension/time_helpers.c
ddtrace-1.10.0 ext/ddtrace_profiling_native_extension/time_helpers.c
ddtrace-1.9.0 ext/ddtrace_profiling_native_extension/time_helpers.c
ddtrace-1.8.0 ext/ddtrace_profiling_native_extension/time_helpers.c