diff options
author | default <nobody@localhost> | 2022-10-02 09:27:17 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2022-10-02 09:27:17 +0200 |
commit | 849913dc5987997f9db96e23c7acf9c29f9c6d7f (patch) | |
tree | 142b0f98c094b4714b49562f90c952abb3e1f233 /snac.c | |
parent | 3161eeb0283f990ba83fbce33d5e3f7f0ad95f24 (diff) |
Use the time functions of xs_time.h.
Diffstat (limited to 'snac.c')
-rw-r--r-- | snac.c | 21 |
1 files changed, 2 insertions, 19 deletions
@@ -14,6 +14,7 @@ #include "xs_mime.h" #include "xs_regex.h" #include "xs_set.h" +#include "xs_time.h" #include "snac.h" @@ -28,24 +29,6 @@ int srv_running = 0; int dbglevel = 0; -d_char *xs_time(char *fmt, int local) -/* returns a d_char with a formated time */ -{ - time_t t = time(NULL); - struct tm tm; - char tmp[64]; - - if (local) - localtime_r(&t, &tm); - else - gmtime_r(&t, &tm); - - strftime(tmp, sizeof(tmp), fmt, &tm); - - return xs_str_new(tmp); -} - - d_char *tid(int offset) /* returns a time-based Id */ { @@ -92,7 +75,7 @@ void srv_debug(int level, d_char *str) } if (dbglevel >= level) { - xs *tm = xs_local_time("%H:%M:%S"); + xs *tm = xs_str_localtime(0, "%H:%M:%S"); fprintf(stderr, "%s %s\n", tm, msg); } } |