From: Michael Poole Date: Sun, 3 Oct 2004 16:34:03 +0000 (+0000) Subject: Doxyfy opercmds.c. X-Git-Url: http://git.pk910.de/?a=commitdiff_plain;h=3fdcd4d2b719e45bbc05553d51bd1d83ae54a029;p=ircu2.10.12-pk.git Doxyfy opercmds.c. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1210 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ircd/opercmds.c b/ircd/opercmds.c index 0cc35a4..f208f94 100644 --- a/ircd/opercmds.c +++ b/ircd/opercmds.c @@ -19,8 +19,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id$ + */ +/** @file + * @brief Implementation of AsLL ping helper commands. + * @version $Id$ */ #include "config.h" @@ -45,6 +47,21 @@ #include #include +/** Calculate current time or elapsed time. + * + * If neither \a sec nor \a usec are NULL, calculate milliseconds + * elapsed since that time, and return a string containing that + * number. + * + * If either \a sec or \a usec are NULL, format a timestamp containing + * Unix timestamp and microseconds since that second (separated by + * spaces), and return a string containing that timestamp. + * + * @todo This should be made into two functions. + * @param[in] sec Either NULL or a Unix timestamp in seconds. + * @param[in] usec Either NULL or an offset to \a sec in microseconds. + * @return A static buffer with contents as described above. + */ char *militime(char* sec, char* usec) { struct timeval tv; @@ -59,6 +76,24 @@ char *militime(char* sec, char* usec) return timebuf; } +/** Calculate current time or elapsed time. + * + * If \a start is NULL, create a timestamp containing Unix timestamp + * and microseconds since that second (separated by a period), and + * return a string containing that timestamp. + * + * Otherwise, if \a start does not contain a period, return a string + * equal to "0". + * + * Otherwise, calculate milliseconds elapsed since the Unix time + * described in \a start (in the format described above), and return a + * string containing that number. + * + * @todo This should be made into two functions. + * @param[in] start Either NULL or a Unix timestamp in + * pseudo-floating-point format. + * @return A static buffer with contents as described above. + */ char *militime_float(char* start) { struct timeval tv; @@ -74,7 +109,7 @@ char *militime_float(char* start) sprintf(timebuf, "%ld", (tv.tv_sec - atoi(start)) * 1000 + (tv.tv_usec - atoi(p)) / 1000); } - else + else strcpy(timebuf, "0"); } else