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:
Kevin Easton
2015-03-29 20:35:57 +11:00
parent 1c6ff3088a
commit 443b87a8aa
3 changed files with 2 additions and 61 deletions

View File

@@ -655,21 +655,13 @@ BUILT_IN_COMMAND(sping)
}
tmp = new_malloc(sizeof(Sping));
tmp->sname = m_strdup(sname);
#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&tmp->in_sping, NULL);
get_time(&tmp->in_sping);
set_server_sping(from_server, tmp);
#else
tmp->in_sping = now;
set_server_sping(from_server, tmp);
#endif
if (!my_stricmp(sname, get_server_name(from_server)) || !my_stricmp(sname, get_server_itsname(from_server)))
#ifdef HAVE_GETTIMEOFDAY
send_to_server("PING LAG%ld.%ld :%s",
(long)tmp->in_sping.tv_sec, (long)tmp->in_sping.tv_usec,
sname);
#else
send_to_server("PING LAG%ld :%s", (long)now, sname);
#endif
else
send_to_server("PING %s :%s",
get_server_itsname(from_server) ?
@@ -678,35 +670,6 @@ BUILT_IN_COMMAND(sping)
}
}
#if 0
#ifdef HAVE_GETTIMEOFDAY
struct timeval in_sping = {0};
#endif
if (!servern || !*servern)
if (!(servern = get_server_itsname(from_server)))
servern = get_server_name(from_server);
if (servern && *servern && wild_match("*.*", servern))
{
#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&in_sping, NULL);
send_to_server("PING LAG%ld.%ld :%s", in_sping.tv_sec, in_sping.tv_usec, servern);
#else
send_to_server("PING LAG%ld :%s", now, servern);
#endif
}
else
{
#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&in_sping, NULL);
set_server_sping(from_server, in_sping);
#else
set_server_sping(from_server, now);
#endif
send_to_server("PING %s :%s", get_server_itsname(from_server), servern);
}
}
#endif
}
BUILT_IN_COMMAND(tog_fprot)