1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
From: Moritz Schlarb <schlarbm@uni-mainz.de>
Date: Wed, 12 Feb 2025 20:58:03 +0100
Subject: Fix time_t transition leftover
Closes: #1091240
---
src/server/monitor/json_output.c | 4 ++--
src/server/timer.c | 4 ++--
src/server/timestamp.c | 2 +-
src/server/timestamp.h | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/server/monitor/json_output.c b/src/server/monitor/json_output.c
index 1305d39..caa49ef 100644
--- a/src/server/monitor/json_output.c
+++ b/src/server/monitor/json_output.c
@@ -220,10 +220,10 @@ static int json_send_backup(struct cstat *cstat, struct bu *bu,
int use_cache, long peer_version)
{
long long bno=0;
- long long timestamp=0;
+ time_t timestamp=0;
if(!bu) return 0;
bno=(long long)bu->bno;
- timestamp=(long long)timestamp_to_long(bu->timestamp);
+ timestamp=timestamp_to_time_t(bu->timestamp);
if(yajl_map_open_w()
|| yajl_gen_int_pair_w("number", bno)
diff --git a/src/server/timer.c b/src/server/timer.c
index 7508883..b3bf560 100644
--- a/src/server/timer.c
+++ b/src/server/timer.c
@@ -151,7 +151,7 @@ static int check_interval(
time_t time_now)
{
char *cp;
- long min_time;
+ time_t min_time;
long seconds=0;
char tstmp[64]="";
char min_time_buf[64]="";
@@ -164,7 +164,7 @@ static int check_interval(
return 0; // Backup now.
}
- min_time=timestamp_to_long(tstmp)+seconds;
+ min_time=timestamp_to_time_t(tstmp)+seconds;
strftime(min_time_buf, sizeof(min_time_buf),
DEFAULT_TIMESTAMP_FORMAT, localtime(&min_time));
cp=strchr(tstmp, ' ');
diff --git a/src/server/timestamp.c b/src/server/timestamp.c
index 88044b0..d14dc48 100644
--- a/src/server/timestamp.c
+++ b/src/server/timestamp.c
@@ -68,7 +68,7 @@ int timestamp_get_new(uint64_t index,
return 0;
}
-long timestamp_to_long(const char *buf)
+time_t timestamp_to_time_t(const char *buf)
{
struct tm tm;
const char *b=NULL;
diff --git a/src/server/timestamp.h b/src/server/timestamp.h
index 997dfab..ae6fa55 100644
--- a/src/server/timestamp.h
+++ b/src/server/timestamp.h
@@ -7,7 +7,7 @@ extern int timestamp_read(const char *path, char buf[], size_t len);
extern int timestamp_write(const char *path, const char *tstmp);
extern int timestamp_get_new(uint64_t index,
char *buf, size_t s, char *bufforfile, size_t bs, const char *format);
-extern long timestamp_to_long(const char *buf);
+extern time_t timestamp_to_time_t(const char *buf);
#ifdef UTEST
extern void timestamp_write_to_buf(char *buf, size_t s,
|