[#absl-IDivDuration] = xref:absl.adoc[absl]::IDivDuration :relfileprefix: ../ :mrdocs: Divides a numerator `Duration` by a denominator `Duration`, returning the quotient and remainder. The remainder always has the same sign as the numerator. The returned quotient and remainder respect the identity: == Synopsis Declared in `<absl/time/time.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int64_t IDivDuration( xref:absl/Duration.adoc[Duration] num, xref:absl/Duration.adoc[Duration] den, xref:absl/Duration.adoc[Duration]* rem); ---- == Description numerator = denominator * quotient + remainder Returned quotients are capped to the range of `int64_t`, with the difference spilling into the remainder to uphold the above identity. This means that the remainder returned could differ from the remainder returned by `Duration::operator%` for huge quotients. See also the notes on `InfiniteDuration()` below regarding the behavior of division involving zero and infinite durations. Example: constexpr absl::Duration a = absl::Seconds(std::numeric_limits<int64_t>::max()); // big constexpr absl::Duration b = absl::Nanoseconds(1); // small absl::Duration rem = a % b; // rem == absl::ZeroDuration() // Here, q would overflow int64_t, so rem accounts for the difference. int64_t q = absl::IDivDuration(a, b, &rem); // q == std::numeric_limits<int64_t>::max(), rem == a ‐ b * q == Return Value The integer quotient of `num` divided by `den`. == Parameters [cols="1,4"] |=== | Name| Description | *num* | The numerator duration. | *den* | The denominator duration. | *rem* | Output parameter receiving the remainder. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#