Remove alternate /sping implementation for systems without gettimeofday()
This changes the code to use struct timeval and get_time() on all systems, which simplifies the code by removing most of the checks for HAVE_GETTIMEOFDAY. The only user-visible change is that ancient systems without gettimeofday() will see message like "Server pong from irc.choopa.net 1.0000 seconds" instead of "Server pong from irc.choopa.net 1.x seconds". And really, I seriously doubt that there's any systems like that left out there anyway.
This commit is contained in:
@@ -825,7 +825,6 @@ static void p_pong(char *from, char **ArgList)
|
||||
char buff[50];
|
||||
struct timeval timenow = {0};
|
||||
struct timeval timethen;
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
if ((p = strchr(ArgList[1], '.')))
|
||||
{
|
||||
*p++ = 0;
|
||||
@@ -833,9 +832,6 @@ static void p_pong(char *from, char **ArgList)
|
||||
} else
|
||||
timethen.tv_usec = 0;
|
||||
timethen.tv_sec = my_atol(ArgList[1]+3);
|
||||
#else
|
||||
timethen.tv_sec = my_atol(ArgList[1]+3);
|
||||
#endif
|
||||
get_time(&timenow);
|
||||
sprintf(buff, "%2.4f", BX_time_diff(timethen, timenow));
|
||||
put_it("%s", convert_output_format("$G Server pong from %W$0%n $1 seconds", "%s %s", ArgList[0], buff));
|
||||
@@ -847,15 +843,10 @@ static void p_pong(char *from, char **ArgList)
|
||||
Sping *tmp;
|
||||
if ((tmp = get_server_sping(from_server, ArgList[0])))
|
||||
{
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
struct timeval timenow = {0};
|
||||
get_time(&timenow);
|
||||
sprintf(buff, "%2.4f", BX_time_diff(tmp->in_sping, timenow));
|
||||
put_it("%s", convert_output_format("$G Server pong from %W$0%n $1 seconds", "%s %s", ArgList[0], buff));
|
||||
#else
|
||||
sprintf(buff, "%2ld.x", now - tmp->in_sping);
|
||||
put_it("%s", convert_output_format("$G Server pong from %W$0%n $1 seconds", "%s %s", ArgList[0], buff));
|
||||
#endif
|
||||
clear_server_sping(from_server, ArgList[0]);
|
||||
if (is_server_connected(from_server))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user