0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-19 08:21:09 +01:00

libratbox: time_t can be 64-bit, so use labs()

This commit is contained in:
William Pitcock 2016-02-10 21:02:56 -06:00
parent ca45daba73
commit a1125230f3

View file

@ -167,7 +167,7 @@ rb_event_frequency(time_t frequency)
{ {
if(frequency < 0) if(frequency < 0)
{ {
const time_t two_third = (2 * abs(frequency)) / 3; const time_t two_third = (2 * labs(frequency)) / 3;
frequency = two_third + ((rand() % 1000) * two_third) / 1000; frequency = two_third + ((rand() % 1000) * two_third) / 1000;
} }
return frequency; return frequency;
@ -186,7 +186,7 @@ rb_event_frequency(time_t frequency)
struct ev_entry * struct ev_entry *
rb_event_addish(const char *name, EVH * func, void *arg, time_t delta_ish) rb_event_addish(const char *name, EVH * func, void *arg, time_t delta_ish)
{ {
delta_ish = abs(delta_ish); delta_ish = labs(delta_ish);
if(delta_ish >= 3.0) if(delta_ish >= 3.0)
delta_ish = -delta_ish; delta_ish = -delta_ish;
return rb_event_add_common(name, func, arg, return rb_event_add_common(name, func, arg,