diff options
Diffstat (limited to 'src/s_misc.c')
-rw-r--r-- | src/s_misc.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/s_misc.c b/src/s_misc.c index 005fac8..855b91a 100644 --- a/src/s_misc.c +++ b/src/s_misc.c @@ -115,6 +115,31 @@ smalldate(time_t lclock) return buf; } +/* + * myctime - This is like standard ctime()-function, but it zaps away + * the newline from the end of that string. Also, it takes + * the time value as parameter, instead of pointer to it. + * Note that it is necessary to copy the string to alternate + * buffer (who knows how ctime() implements it, maybe it statically + * has newline there and never 'refreshes' it -- zapping that + * might break things in other places...) + * + * + * Thu Nov 24 18:22:48 1986 + */ +const char * +myctime(time_t value) +{ + static char buf[32]; + char *p; + + strlcpy(buf, ctime(&value), sizeof(buf)); + + if ((p = strchr(buf, '\n')) != NULL) + *p = '\0'; + return buf; +} + #ifdef HAVE_LIBCRYPTO const char * ssl_get_cipher(const SSL *ssl) |