New function ftime().

This commit is contained in:
default 2022-09-28 17:18:30 +02:00
parent 5647e675fd
commit e7e89d2d57
3 changed files with 16 additions and 0 deletions

6
html.c
View File

@ -522,6 +522,7 @@ d_char *html_timeline(snac *snac, char *list, int local)
d_char *s = xs_str_new(NULL);
xs_set *seen = xs_set_new(4096);
char *v;
double t = ftime();
s = html_user_header(snac, s, local);
@ -540,6 +541,11 @@ d_char *html_timeline(snac *snac, char *list, int local)
s = html_user_footer(snac, s);
{
xs *s1 = xs_fmt("<!-- %lf seconds -->\n", ftime() - t);
s = xs_str_cat(s, s1);
}
s = xs_str_cat(s, "</body>\n</html>\n");
xs_set_free(seen);

9
snac.c
View File

@ -58,6 +58,15 @@ d_char *tid(int offset)
}
double ftime(void)
/* returns the UNIX time as a float */
{
xs *ntid = tid(0);
return atof(ntid);
}
int validate_uid(char *uid)
/* returns if uid is a valid identifier */
{

1
snac.h
View File

@ -23,6 +23,7 @@ d_char *xs_time(char *fmt, int local);
#define xs_utc_time(fmt) xs_time(fmt, 0)
d_char *tid(int offset);
double ftime(void);
void srv_debug(int level, d_char *str);
#define srv_log(str) srv_debug(0, str)