I said test availability at runtime.
There's `glib_check_version()`, although the spec makes it sound like the target is supposed to be the same version as your own development library (*). ```diff diff --git a/src/utils.c b/src/utils.c index 6f7cb5b0..ecd2c3eb 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1050,7 +1050,8 @@ gint utils_parse_color_to_bgr(const gchar *spec) gchar *utils_get_current_time_string(gboolean include_microseconds) { GDateTime *now = g_date_time_new_now_local(); - const gchar *format = include_microseconds ? "%H:%M:%S.%f" : "%H:%M:%S"; + const gboolean have_f_time_fmt_spec = (glib_check_version(2, 65, 2) == NULL); + const gchar *format = (have_f_time_fmt_spec && include_microseconds) ? "%H:%M:%S.%f" : "%H:%M:%S"; gchar *time_string = g_date_time_format(now, format); g_date_time_unref(now); return time_string; ``` --- (*)
Generally you would pass in the constants GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION as the three arguments to this function; that produces a check that the library in use is compatible with the version of GLib the application or module was compiled against.
https://developer-old.gnome.org/glib/stable/glib-Version-Information.html#glib-check-version