Fix build with glib < 2.62

This commit is contained in:
Tom Stellard 2020-10-19 09:39:13 -07:00
parent 3ca25bc3df
commit 80f57abba9
2 changed files with 18 additions and 0 deletions

View File

@ -43,7 +43,11 @@ debug_print_message(gchar *format, ...)
gchar buf[SMALL];
const gchar *home;
FILE *fil = NULL;
#ifdef GLIB_VERSION_2_62
GDateTime *logtime;
#else
GTimeVal logtime;
#endif
gchar *logtime_string;
if(format != NULL)
@ -58,10 +62,15 @@ debug_print_message(gchar *format, ...)
if(debug_output != DEBUG_OUT_STDOUT)
{
#ifdef GLIB_VERSION_2_62
gint64 current_time = g_get_real_time();
logtime = g_date_time_new_from_unix_utc(current_time);
logtime_string = g_date_time_format_iso8601(logtime);
g_date_time_unref(logtime);
#else
g_get_current_time(&logtime);
logtime_string = g_time_val_to_iso8601(&logtime);
#endif
sprintf(text, "%s %s\n", logtime_string, buf);
g_free(logtime_string);

View File

@ -686,7 +686,16 @@ handle_required_reserve_relegation(const TeamMove *move, GArray *team_movements)
/* We have found the last relegation for this league, so
* insert the new_move here. */
gint insert_index = k + 1;
#ifdef GLIB_VERSION_2_62
new_move.dest_idcs = g_array_copy(move->dest_idcs);
#else
new_move.dest_idcs = g_array_sized_new(FALSE, FALSE,
sizeof(gint),
move->dest_idcs->len);
g_array_append_vals(new_move.dest_idcs,
move->dest_idcs->data,
move->dest_idcs->len);
#endif
if(debug > 70) {
printf("Adding relegation of %s\n", reserve_team->name);