mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 13:25:04 +00:00
Use doubles instead of floats.
This commit is contained in:
parent
3d544233a6
commit
a52840414d
2 changed files with 12 additions and 12 deletions
18
data.c
18
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 */
|
/* returns the mtime of a file or directory, or 0.0 */
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
float r = 0.0;
|
double r = 0.0;
|
||||||
|
|
||||||
if (fn && stat(fn, &st) != -1)
|
if (fn && stat(fn, &st) != -1)
|
||||||
r = (float)st.st_mtim.tv_sec;
|
r = (double)st.st_mtim.tv_sec;
|
||||||
|
|
||||||
return r;
|
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);
|
xs *fn = xs_fmt("%s/timeline", snac->basedir);
|
||||||
return mtime(fn);
|
return mtime(fn);
|
||||||
|
@ -769,8 +769,8 @@ int actor_get(snac *snac, char *actor, d_char **data)
|
||||||
/* returns an already downloaded actor */
|
/* returns an already downloaded actor */
|
||||||
{
|
{
|
||||||
xs *fn = _actor_fn(snac, actor);
|
xs *fn = _actor_fn(snac, actor);
|
||||||
float t;
|
double t;
|
||||||
float max_time;
|
double max_time;
|
||||||
int status;
|
int status;
|
||||||
FILE *f;
|
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 */
|
/* maximum time for the actor data to be considered stale */
|
||||||
max_time = 3600.0 * 36.0;
|
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 */
|
/* actor data exists but also stinks */
|
||||||
|
|
||||||
if ((f = fopen(fn, "a")) != NULL) {
|
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);
|
xs *fn = _history_fn(snac, id);
|
||||||
|
|
||||||
if (fn != NULL)
|
if (fn != NULL)
|
||||||
|
|
6
snac.h
6
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,
|
void srv_archive(char *direction, char *req, char *payload, int p_size,
|
||||||
int status, char *headers, char *body, int b_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_add(snac *snac, char *actor, char *msg);
|
||||||
int follower_del(snac *snac, char *actor);
|
int follower_del(snac *snac, char *actor);
|
||||||
int follower_check(snac *snac, char *actor);
|
int follower_check(snac *snac, char *actor);
|
||||||
d_char *follower_list(snac *snac);
|
d_char *follower_list(snac *snac);
|
||||||
|
|
||||||
float timeline_mtime(snac *snac);
|
double timeline_mtime(snac *snac);
|
||||||
int timeline_here(snac *snac, char *id);
|
int timeline_here(snac *snac, char *id);
|
||||||
d_char *_timeline_find_fn(snac *snac, char *id);
|
d_char *_timeline_find_fn(snac *snac, char *id);
|
||||||
d_char *timeline_find(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);
|
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);
|
void history_add(snac *snac, char *id, char *content, int size);
|
||||||
d_char *history_get(snac *snac, char *id);
|
d_char *history_get(snac *snac, char *id);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue