snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit e7e89d2d57b9308884385c2e97bd750475385cc4
parent 5647e675fd59d06b8a9a6016076b45978bdd4d4b
Author: default <nobody@localhost>
Date:   Wed, 28 Sep 2022 17:18:30 +0200

New function ftime().

Diffstat:
Mhtml.c | 6++++++
Msnac.c | 9+++++++++
Msnac.h | 1+
3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/html.c b/html.c @@ -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); diff --git a/snac.c b/snac.c @@ -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 */ { diff --git a/snac.h b/snac.h @@ -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)