diff options
| author | 2022-09-30 09:59:13 +0200 | |
|---|---|---|
| committer | 2022-09-30 09:59:13 +0200 | |
| commit | a52840414d2c8482e1d27ec9d0da7babcf2eb545 (patch) | |
| tree | 30451ddc3216cbca07a7126caed8fbc5510680d8 | |
| parent | Timeline is cached. (diff) | |
| download | snac2-a52840414d2c8482e1d27ec9d0da7babcf2eb545.tar.gz snac2-a52840414d2c8482e1d27ec9d0da7babcf2eb545.tar.xz snac2-a52840414d2c8482e1d27ec9d0da7babcf2eb545.zip | |
Use doubles instead of floats.
| -rw-r--r-- | data.c | 18 | ||||
| -rw-r--r-- | snac.h | 6 |
2 files changed, 12 insertions, 12 deletions
| @@ -172,14 +172,14 @@ d_char *user_list(void) | |||
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | 174 | ||
| 175 | float mtime(char *fn) | 175 | double mtime(char *fn) |
| 176 | /* returns the mtime of a file or directory, or 0.0 */ | 176 | /* returns the mtime of a file or directory, or 0.0 */ |
| 177 | { | 177 | { |
| 178 | struct stat st; | 178 | struct stat st; |
| 179 | float r = 0.0; | 179 | double r = 0.0; |
| 180 | 180 | ||
| 181 | if (fn && stat(fn, &st) != -1) | 181 | if (fn && stat(fn, &st) != -1) |
| 182 | r = (float)st.st_mtim.tv_sec; | 182 | r = (double)st.st_mtim.tv_sec; |
| 183 | 183 | ||
| 184 | return r; | 184 | return r; |
| 185 | } | 185 | } |
| @@ -275,7 +275,7 @@ d_char *follower_list(snac *snac) | |||
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | 277 | ||
| 278 | float timeline_mtime(snac *snac) | 278 | double timeline_mtime(snac *snac) |
| 279 | { | 279 | { |
| 280 | xs *fn = xs_fmt("%s/timeline", snac->basedir); | 280 | xs *fn = xs_fmt("%s/timeline", snac->basedir); |
| 281 | return mtime(fn); | 281 | return mtime(fn); |
| @@ -769,8 +769,8 @@ int actor_get(snac *snac, char *actor, d_char **data) | |||
| 769 | /* returns an already downloaded actor */ | 769 | /* returns an already downloaded actor */ |
| 770 | { | 770 | { |
| 771 | xs *fn = _actor_fn(snac, actor); | 771 | xs *fn = _actor_fn(snac, actor); |
| 772 | float t; | 772 | double t; |
| 773 | float max_time; | 773 | double max_time; |
| 774 | int status; | 774 | int status; |
| 775 | FILE *f; | 775 | FILE *f; |
| 776 | 776 | ||
| @@ -783,7 +783,7 @@ int actor_get(snac *snac, char *actor, d_char **data) | |||
| 783 | /* maximum time for the actor data to be considered stale */ | 783 | /* maximum time for the actor data to be considered stale */ |
| 784 | max_time = 3600.0 * 36.0; | 784 | max_time = 3600.0 * 36.0; |
| 785 | 785 | ||
| 786 | if (t + max_time < (float) time(NULL)) { | 786 | if (t + max_time < (double) time(NULL)) { |
| 787 | /* actor data exists but also stinks */ | 787 | /* actor data exists but also stinks */ |
| 788 | 788 | ||
| 789 | if ((f = fopen(fn, "a")) != NULL) { | 789 | if ((f = fopen(fn, "a")) != NULL) { |
| @@ -845,9 +845,9 @@ d_char *_history_fn(snac *snac, char *id) | |||
| 845 | } | 845 | } |
| 846 | 846 | ||
| 847 | 847 | ||
| 848 | float history_mtime(snac *snac, char * id) | 848 | double history_mtime(snac *snac, char * id) |
| 849 | { | 849 | { |
| 850 | float t = 0.0; | 850 | double t = 0.0; |
| 851 | xs *fn = _history_fn(snac, id); | 851 | xs *fn = _history_fn(snac, id); |
| 852 | 852 | ||
| 853 | if (fn != NULL) | 853 | if (fn != NULL) |
| @@ -53,14 +53,14 @@ int check_password(char *uid, char *passwd, char *hash); | |||
| 53 | void srv_archive(char *direction, char *req, char *payload, int p_size, | 53 | void srv_archive(char *direction, char *req, char *payload, int p_size, |
| 54 | int status, char *headers, char *body, int b_size); | 54 | int status, char *headers, char *body, int b_size); |
| 55 | 55 | ||
| 56 | float mtime(char *fn); | 56 | double mtime(char *fn); |
| 57 | 57 | ||
| 58 | int follower_add(snac *snac, char *actor, char *msg); | 58 | int follower_add(snac *snac, char *actor, char *msg); |
| 59 | int follower_del(snac *snac, char *actor); | 59 | int follower_del(snac *snac, char *actor); |
| 60 | int follower_check(snac *snac, char *actor); | 60 | int follower_check(snac *snac, char *actor); |
| 61 | d_char *follower_list(snac *snac); | 61 | d_char *follower_list(snac *snac); |
| 62 | 62 | ||
| 63 | float timeline_mtime(snac *snac); | 63 | double timeline_mtime(snac *snac); |
| 64 | int timeline_here(snac *snac, char *id); | 64 | int timeline_here(snac *snac, char *id); |
| 65 | d_char *_timeline_find_fn(snac *snac, char *id); | 65 | d_char *_timeline_find_fn(snac *snac, char *id); |
| 66 | d_char *timeline_find(snac *snac, char *id); | 66 | d_char *timeline_find(snac *snac, char *id); |
| @@ -85,7 +85,7 @@ int actor_get(snac *snac, char *actor, d_char **data); | |||
| 85 | 85 | ||
| 86 | int static_get(snac *snac, char *id, d_char **data, int *size); | 86 | int static_get(snac *snac, char *id, d_char **data, int *size); |
| 87 | 87 | ||
| 88 | float history_mtime(snac *snac, char *id); | 88 | double history_mtime(snac *snac, char *id); |
| 89 | void history_add(snac *snac, char *id, char *content, int size); | 89 | void history_add(snac *snac, char *id, char *content, int size); |
| 90 | d_char *history_get(snac *snac, char *id); | 90 | d_char *history_get(snac *snac, char *id); |
| 91 | 91 | ||