This replaces the use of the native strftime() function to use GLib's GDateTime functions which should work more platform agnostic.
Fixes #2968. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3037
-- Commit Summary --
* Use GDateTime for date and time formatting
-- File Changes --
M data/geany.glade (8) M doc/geany.txt (29) M plugins/saveactions.c (2) M src/printing.c (2) M src/ui_utils.c (2) M src/utils.c (44)
-- Patch Links --
https://github.com/geany/geany/pull/3037.patch https://github.com/geany/geany/pull/3037.diff
`GDateTime` is available since GLib 2.26, we already require 2.32 so this should be fine.
In G-P there is no direct use of `strftime` and only the PoHelper plugin uses `utils_get_date_time` with a fixed format (including `%z` which produced the wrong output on Windows until now!).
I'm not sure whether it is clever to use the GTK docs URL in dialogs, they get quite wide because of the long string. Maybe it is enough to refer to *our* manual where the GTK docs link can be found anyway?
@techee could you maybe test on Macos? Either this PR directly or the little test program in #2968 (comment).
It seems both of the functions return the same result on macOS: ``` Format: %a, %d %b %Y %T %z: CRT : Wed, 01 Dec 2021 20:44:58 +0100 GLib: Wed, 01 Dec 2021 20:44:58 +0100
Format: %a, %d %b %Y %T %Z: CRT : Wed, 01 Dec 2021 20:44:58 CET GLib: Wed, 01 Dec 2021 20:44:58 CET
Format: %a, %d %b %Y %H:%M:%S %z: CRT : Wed, 01 Dec 2021 20:44:58 +0100 GLib: Wed, 01 Dec 2021 20:44:58 +0100
Format: %a, %d %b %Y %H:%M:%S %Z: CRT : Wed, 01 Dec 2021 20:44:58 CET GLib: Wed, 01 Dec 2021 20:44:58 CET ```
It seems both of the functions return the same result on macOS:
Great, this looks like the output on Linux. Thanks for testing!
Merged #3037 into master.
github-comments@lists.geany.org