Patch-Source: https://github.com/pgpool/pgpool2/pull/78 commit ac848ddf7e095c49053ab7937a48534ccf2475ba Author: Andy Postnikov Date: Sun Oct 27 14:04:24 2024 +0100 fix build 64-bit time_t for 32-bits diff --git a/src/include/utils/json.h b/src/include/utils/json.h index 67cc0255..dccf2c0d 100644 --- a/src/include/utils/json.h +++ b/src/include/utils/json.h @@ -313,7 +313,7 @@ extern "C" /* pgpool-II extensions */ json_value *json_get_value_for_key(json_value * source, const char *key); int json_get_int_value_for_key(json_value * source, const char *key, int *value); -int json_get_long_value_for_key(json_value * source, const char *key, long *value); +int json_get_long_value_for_key(json_value * source, const char *key, time_t *value); char *json_get_string_value_for_key(json_value * source, const char *key); int json_get_bool_value_for_key(json_value * source, const char *key, bool *value); diff --git a/src/include/watchdog/wd_json_data.h b/src/include/watchdog/wd_json_data.h index 7b53999e..c4d3dbd5 100644 --- a/src/include/watchdog/wd_json_data.h +++ b/src/include/watchdog/wd_json_data.h @@ -51,8 +51,8 @@ extern bool parse_node_status_json(char *json_data, int data_len, int *nodeID, i extern bool parse_beacon_message_json(char *json_data, int data_len, int *state, - long *seconds_since_node_startup, - long *seconds_since_current_state, + time_t *seconds_since_node_startup, + time_t *seconds_since_current_state, int *quorumStatus, int *standbyNodesCount, bool *escalated); diff --git a/src/utils/json.c b/src/utils/json.c index 319c8fdb..1faa9501 100644 --- a/src/utils/json.c +++ b/src/utils/json.c @@ -1191,7 +1191,7 @@ json_get_int_value_for_key(json_value * source, const char *key, int *value) } int -json_get_long_value_for_key(json_value * source, const char *key, long *value) +json_get_long_value_for_key(json_value * source, const char *key, time_t *value) { json_value *jNode; diff --git a/src/watchdog/watchdog.c b/src/watchdog/watchdog.c index 0c29cc68..d8ef4186 100644 --- a/src/watchdog/watchdog.c +++ b/src/watchdog/watchdog.c @@ -6529,8 +6529,8 @@ static bool beacon_message_received_from_node(WatchdogNode * wdNode, WDPacketData * pkt) { - long seconds_since_node_startup; - long seconds_since_current_state; + time_t seconds_since_node_startup; + time_t seconds_since_current_state; int quorum_status; int standby_nodes_count; bool escalated; diff --git a/src/watchdog/wd_commands.c b/src/watchdog/wd_commands.c index 14595586..3f6c6e14 100644 --- a/src/watchdog/wd_commands.c +++ b/src/watchdog/wd_commands.c @@ -193,7 +193,7 @@ get_wd_runtime_variable_value(char* wd_authkey, char *varName) case VALUE_DATA_TYPE_LONG: { - long longVal; + time_t longVal; if (json_get_long_value_for_key(root, WD_JSON_KEY_VALUE_DATA, &longVal)) { diff --git a/src/watchdog/wd_heartbeat.c b/src/watchdog/wd_heartbeat.c index 67dcf505..f657cf56 100644 --- a/src/watchdog/wd_heartbeat.c +++ b/src/watchdog/wd_heartbeat.c @@ -653,7 +653,7 @@ { int len; - len = snprintf(str, maxlen, "tv_sec=%ld tv_usec=%ld from=%s", + len = snprintf(str, maxlen, "tv_sec=%lld tv_usec=%lld from=%s", pkt->send_time.tv_sec, pkt->send_time.tv_usec, pkt->from); return len; diff --git a/src/watchdog/wd_json_data.c b/src/watchdog/wd_json_data.c index 474fc37a..2b5dee7a 100644 --- a/src/watchdog/wd_json_data.c +++ b/src/watchdog/wd_json_data.c @@ -540,8 +540,8 @@ get_watchdog_node_from_json(char *json_data, int data_len, char **authkey) if (json_get_long_value_for_key(root, "StartupTimeSecs", &wdNode->startup_time.tv_sec)) { bool escalated; - long seconds_since_node_startup; - long seconds_since_current_state; + time_t seconds_since_node_startup; + time_t seconds_since_current_state; struct timeval current_time; gettimeofday(¤t_time, NULL); @@ -640,8 +640,8 @@ ERROR_EXIT: bool parse_beacon_message_json(char *json_data, int data_len, int *state, - long *seconds_since_node_startup, - long *seconds_since_current_state, + time_t *seconds_since_node_startup, + time_t *seconds_since_current_state, int *quorumStatus, int *standbyNodesCount, bool *escalated)