absl::Nanoseconds

Constructs a Duration from a floating-point number of nanoseconds.

Synopsis

Declared in <absl/time/time.h>

template<
    typename T,
    /* implementation-defined */ = 0>
Duration
Nanoseconds(T n);

Description

Factory overloads for constructing Duration values from a floating-point number of the unit indicated by the factory function's name. These functions exist for convenience, but they are not as efficient as the integral factories, which should be preferred.

Example:

auto a = absl::Seconds(1.5); // OK auto b = absl::Milliseconds(1500); // BETTER

Return Value

A duration of n nanoseconds.

Parameters

NameDescription
nThe number of nanoseconds.