From a52840414d2c8482e1d27ec9d0da7babcf2eb545 Mon Sep 17 00:00:00 2001 From: default Date: Fri, 30 Sep 2022 09:59:13 +0200 Subject: [PATCH] Use doubles instead of floats. --- data.c | 18 +++++++++--------- snac.h | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/data.c b/data.c index 5eb729c..4aba816 100644 --- a/data.c +++ b/data.c @@ -172,14 +172,14 @@ d_char *user_list(void) } -float mtime(char *fn) +double mtime(char *fn) /* returns the mtime of a file or directory, or 0.0 */ { struct stat st; - float r = 0.0; + double r = 0.0; if (fn && stat(fn, &st) != -1) - r = (float)st.st_mtim.tv_sec; + r = (double)st.st_mtim.tv_sec; return r; } @@ -275,7 +275,7 @@ d_char *follower_list(snac *snac) } -float timeline_mtime(snac *snac) +double timeline_mtime(snac *snac) { xs *fn = xs_fmt("%s/timeline", snac->basedir); return mtime(fn); @@ -769,8 +769,8 @@ int actor_get(snac *snac, char *actor, d_char **data) /* returns an already downloaded actor */ { xs *fn = _actor_fn(snac, actor); - float t; - float max_time; + double t; + double max_time; int status; FILE *f; @@ -783,7 +783,7 @@ int actor_get(snac *snac, char *actor, d_char **data) /* maximum time for the actor data to be considered stale */ max_time = 3600.0 * 36.0; - if (t + max_time < (float) time(NULL)) { + if (t + max_time < (double) time(NULL)) { /* actor data exists but also stinks */ if ((f = fopen(fn, "a")) != NULL) { @@ -845,9 +845,9 @@ d_char *_history_fn(snac *snac, char *id) } -float history_mtime(snac *snac, char * id) +double history_mtime(snac *snac, char * id) { - float t = 0.0; + double t = 0.0; xs *fn = _history_fn(snac, id); if (fn != NULL) diff --git a/snac.h b/snac.h index 451fd78..0dce10a 100644 --- a/snac.h +++ b/snac.h @@ -53,14 +53,14 @@ int check_password(char *uid, char *passwd, char *hash); void srv_archive(char *direction, char *req, char *payload, int p_size, int status, char *headers, char *body, int b_size); -float mtime(char *fn); +double mtime(char *fn); int follower_add(snac *snac, char *actor, char *msg); int follower_del(snac *snac, char *actor); int follower_check(snac *snac, char *actor); d_char *follower_list(snac *snac); -float timeline_mtime(snac *snac); +double timeline_mtime(snac *snac); int timeline_here(snac *snac, char *id); d_char *_timeline_find_fn(snac *snac, char *id); d_char *timeline_find(snac *snac, char *id); @@ -85,7 +85,7 @@ int actor_get(snac *snac, char *actor, d_char **data); int static_get(snac *snac, char *id, d_char **data, int *size); -float history_mtime(snac *snac, char *id); +double history_mtime(snac *snac, char *id); void history_add(snac *snac, char *id, char *content, int size); d_char *history_get(snac *snac, char *id);