global: use clock_time in place of time_now().

Except for tracing, that sticks with time_now().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2025-11-13 16:02:35 +10:30
parent dc9b425035
commit 8b9020d7b9
52 changed files with 146 additions and 85 deletions

View File

@@ -10,6 +10,7 @@
#include <ccan/time/time.h>
#include <common/bech32.h>
#include <common/bolt11.h>
#include <common/clock_time.h>
#include <common/features.h>
#include <common/setup.h>
#include <common/utils.h>
@@ -109,7 +110,7 @@ static void encode(const tal_t *ctx,
struct pubkey me;
bool explicit_n = false;
b11->timestamp = time_now().ts.tv_sec;
b11->timestamp = clock_time().ts.tv_sec;
b11->chain = chainparams_for_network("regtest");
b11->expiry = 3600;
b11->min_final_cltv_expiry = DEFAULT_FINAL_CLTV_DELTA;

View File

@@ -8,6 +8,7 @@
#include <ccan/str/hex/hex.h>
#include <ccan/tal/str/str.h>
#include <ccan/time/time.h>
#include <common/clock_time.h>
#include <common/cryptomsg.h>
#include <common/features.h>
#include <common/ping.h>
@@ -209,7 +210,7 @@ static struct io_plan *handshake_success(struct io_conn *conn,
msg = towire_gossip_timestamp_filter(NULL,
&chainparams->genesis_blockhash,
all_gossip ? 0
: no_gossip ? 0xFFFFFFFF : time_now().ts.tv_sec,
: no_gossip ? 0xFFFFFFFF : clock_time().ts.tv_sec,
0xFFFFFFFF);
sync_crypto_write(peer_fd, cs, take(msg));
}