Browse Source

New function ftime().

default 2 years ago
parent
commit
e7e89d2d57
3 changed files with 16 additions and 0 deletions
  1. 6 0
      html.c
  2. 9 0
      snac.c
  3. 1 0
      snac.h

+ 6 - 0
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);

+ 9 - 0
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 */
 {

+ 1 - 0
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)