[Github-comments] [geany/geany] Null time on debug messages (Issue #3071)
Robert Di Pardo
notifications at xxxxx
Wed Dec 29 22:28:47 UTC 2021
> 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>
--
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/3071#issuecomment-1002798586
You are receiving this because you are subscribed to this thread.
Message ID: <geany/geany/issues/3071/1002798586 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20211229/34d84c34/attachment.htm>
More information about the Github-comments
mailing list