myctime -> rb_ctime

This commit is contained in:
Valery Yatsko 2008-04-20 09:03:39 +04:00
parent 928ce024f4
commit 08a5f1f948
5 changed files with 6 additions and 39 deletions

View File

@ -95,8 +95,6 @@ char *strip_colour(char *string);
*/
char *strip_tabs(char *dest, const unsigned char *src, size_t len);
const char *myctime(time_t);
#define EmptyString(x) ((x) == NULL || *(x) == '\0')
#define CheckEmpty(x) EmptyString(x) ? "" : x

View File

@ -670,13 +670,14 @@ send_info_text(struct Client *source_p)
static void
send_birthdate_online_time(struct Client *source_p)
{
char tbuf[26]; /* this needs to be 26 - see ctime_r manpage */
sendto_one(source_p, ":%s %d %s :Birth Date: %s, compile # %s",
get_id(&me, source_p), RPL_INFO,
get_id(source_p, source_p), creation, generation);
sendto_one(source_p, ":%s %d %s :On-line since %s",
get_id(&me, source_p), RPL_INFO,
get_id(source_p, source_p), myctime(startup_time));
get_id(source_p, source_p), rb_ctime(startup_time, tbuf, sizeof(tbuf)));
}
/*

View File

@ -64,6 +64,7 @@ m_whowas(struct Client *client_p, struct Client *source_p, int parc, const char
int max = -1, found = 0;
char *p;
const char *nick;
char tbuf[26];
static time_t last_used = 0L;
@ -118,7 +119,7 @@ m_whowas(struct Client *client_p, struct Client *source_p, int parc, const char
sendto_one_numeric(source_p, RPL_WHOISSERVER,
form_str(RPL_WHOISSERVER),
temp->name, temp->servername,
myctime(temp->logoff));
rb_ctime(temp->logoff, tbuf, sizeof(tbuf)));
cur++;
found++;
}

View File

@ -1512,6 +1512,7 @@ exit_local_client(struct Client *client_p, struct Client *source_p, struct Clien
const char *comment)
{
unsigned long on_for;
char tbuf[26];
exit_generic_client(client_p, source_p, from, comment);
clear_monitor(source_p);
@ -1538,7 +1539,7 @@ exit_local_client(struct Client *client_p, struct Client *source_p, struct Clien
on_for = rb_current_time() - source_p->localClient->firsttime;
ilog(L_USER, "%s (%3lu:%02lu:%02lu): %s!%s@%s %d/%d",
myctime(rb_current_time()), on_for / 3600,
rb_ctime(rb_current_time(), tbuf, sizeof(tbuf)), on_for / 3600,
(on_for % 3600) / 60, on_for % 60,
source_p->name, source_p->username, source_p->host,
source_p->localClient->sendK, source_p->localClient->receiveK);

View File

@ -30,43 +30,9 @@
#include "client.h"
#include "setup.h"
#ifndef INADDRSZ
#define INADDRSZ 4
#endif
#ifdef RB_IPV6
#ifndef IN6ADDRSZ
#define IN6ADDRSZ 16
#endif
#endif
#ifndef INT16SZ
#define INT16SZ 2
#endif
/*
* 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;
strcpy(buf, ctime(&value));
if((p = strchr(buf, '\n')) != NULL)
*p = '\0';
return buf;
}
/*
* clean_string - clean up a string possibly containing garbage