Commit 72246a56 authored by Philip Withnall's avatar Philip Withnall
Browse files

gdatetime: Use isnan() instead of !isfinite()

Both are provided by libm, but `isnan()` is provided as a macro, whereas
`isfinite()` is an actual function, and hence libm has to be available
at runtime. That didn’t trivially work on FreeBSD, resulting in this

`isfinite(x)` is equivalent to `!isnan(x) && !isinfinite(x)`. The case
of `x` being (negative or positive) infinity is already handled by the
range checks on the next line, so it’s safe to switch to `isnan()` here.
Signed-off-by: Philip Withnall's avatarPhilip Withnall <>
parent e470dca9
......@@ -1588,7 +1588,7 @@ g_date_time_new (GTimeZone *tz,
day < 1 || day > days_in_months[GREGORIAN_LEAP (year)][month] ||
hour < 0 || hour > 23 ||
minute < 0 || minute > 59 ||
!isfinite (seconds) ||
isnan (seconds) ||
seconds < 0.0 || seconds >= 60.0)
return NULL;
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