[#absl-IDivDuration]
= xref:absl.adoc[absl]::IDivDuration
:relfileprefix: ../
:mrdocs:

Divides a numerator `Duration` by a denominator `Duration`, returning the quotient and remainder&period; The remainder always has the same sign as the numerator&period; The returned quotient and remainder respect the identity&colon;

== Synopsis

Declared in `&lt;absl&sol;time&sol;time&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int64&lowbar;t
IDivDuration(
    xref:absl/Duration.adoc[Duration] num,
    xref:absl/Duration.adoc[Duration] den,
    xref:absl/Duration.adoc[Duration]* rem);
----

== Description

numerator &equals; denominator &ast; quotient &plus; remainder

Returned quotients are capped to the range of `int64&lowbar;t`, with the difference spilling into the remainder to uphold the above identity&period; This means that the remainder returned could differ from the remainder returned by `Duration&colon;&colon;operator%` for huge quotients&period;

See also the notes on `InfiniteDuration()` below regarding the behavior of division involving zero and infinite durations&period;

Example&colon;

constexpr absl&colon;&colon;Duration a &equals; absl&colon;&colon;Seconds(std&colon;&colon;numeric&lowbar;limits&lt;int64&lowbar;t&gt;&colon;&colon;max())&semi; &sol;&sol; big constexpr absl&colon;&colon;Duration b &equals; absl&colon;&colon;Nanoseconds(1)&semi; &sol;&sol; small

absl&colon;&colon;Duration rem &equals; a % b&semi; &sol;&sol; rem &equals;&equals; absl&colon;&colon;ZeroDuration()

&sol;&sol; Here, q would overflow int64&lowbar;t, so rem accounts for the difference&period; int64&lowbar;t q &equals; absl&colon;&colon;IDivDuration(a, b, &amp;rem)&semi; &sol;&sol; q &equals;&equals; std&colon;&colon;numeric&lowbar;limits&lt;int64&lowbar;t&gt;&colon;&colon;max(), rem &equals;&equals; a &hyphen; b &ast; q

== Return Value

The integer quotient of `num` divided by `den`&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *num*
| The numerator duration&period;
| *den*
| The denominator duration&period;
| *rem*
| Output parameter receiving the remainder&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
