Changeset View
Changeset View
Standalone View
Standalone View
head/sbin/ping/ping.c
Show First 20 Lines • Show All 1,655 Lines • ▼ Show 20 Lines | pr_retip(struct ip *ip) | ||||
else if (ip->ip_p == 17) | else if (ip->ip_p == 17) | ||||
(void)printf("UDP: from port %u, to port %u (decimal)\n", | (void)printf("UDP: from port %u, to port %u (decimal)\n", | ||||
(*cp * 256 + *(cp + 1)), (*(cp + 2) * 256 + *(cp + 3))); | (*cp * 256 + *(cp + 1)), (*(cp + 2) * 256 + *(cp + 3))); | ||||
} | } | ||||
static char * | static char * | ||||
pr_ntime(n_time timestamp) | pr_ntime(n_time timestamp) | ||||
{ | { | ||||
static char buf[10]; | static char buf[11]; | ||||
int hour, min, sec; | int hour, min, sec; | ||||
sec = ntohl(timestamp) / 1000; | sec = ntohl(timestamp) / 1000; | ||||
hour = sec / 60 / 60; | hour = sec / 60 / 60; | ||||
min = (sec % (60 * 60)) / 60; | min = (sec % (60 * 60)) / 60; | ||||
sec = (sec % (60 * 60)) % 60; | sec = (sec % (60 * 60)) % 60; | ||||
(void)snprintf(buf, sizeof(buf), "%02d:%02d:%02d", hour, min, sec); | (void)snprintf(buf, sizeof(buf), "%02d:%02d:%02d", hour, min, sec); | ||||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |