Commit 195f14da authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

date_Increment: use lldiv()

parent d158270e
...@@ -434,9 +434,11 @@ void date_Move( date_t *p_date, mtime_t i_difference ) ...@@ -434,9 +434,11 @@ void date_Move( date_t *p_date, mtime_t i_difference )
*/ */
mtime_t date_Increment( date_t *p_date, uint32_t i_nb_samples ) mtime_t date_Increment( date_t *p_date, uint32_t i_nb_samples )
{ {
mtime_t i_dividend = (mtime_t)i_nb_samples * 1000000 * p_date->i_divider_den; mtime_t i_dividend = i_nb_samples * CLOCK_FREQ * p_date->i_divider_den;
p_date->date += i_dividend / p_date->i_divider_num; lldiv_t d = lldiv( i_dividend, p_date->i_divider_num );
p_date->i_remainder += (int)(i_dividend % p_date->i_divider_num);
p_date->date += d.quot;
p_date->i_remainder += (int)d.rem;
if( p_date->i_remainder >= p_date->i_divider_num ) if( p_date->i_remainder >= p_date->i_divider_num )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment