Truncates a duration (toward zero) to a multiple of a non‐zero unit.

Synopsis

Declared in <absl/time/time.h>

Duration
Trunc(
    Duration d,
    Duration unit);

Description

Example:

absl::Duration d = absl::Nanoseconds(123456789); absl::Duration a = absl::Trunc(d, absl::Microseconds(1)); // 123456us

Return Value

d truncated toward zero to a multiple of unit.

Parameters

Name

Description

d

The duration to truncate.

unit

The unit to truncate to.

Created with MrDocs