131 | 131 |
fprintf(stderr, "-m give machine parseable output (see\n");
|
132 | 132 |
fprintf(stderr, " also -o and -e)\n");
|
133 | 133 |
fprintf(stderr, "-o rc,rc,... what http results codes indicate 'ok'\n");
|
134 | |
fprintf(stderr, " coma seperated WITHOUT spaces inbetween\n");
|
|
134 |
fprintf(stderr, " comma seperated WITHOUT spaces inbetween\n");
|
135 | 135 |
fprintf(stderr, " default is 200, use with -e\n");
|
136 | 136 |
fprintf(stderr, "-e str string to display when http result code\n");
|
137 | 137 |
fprintf(stderr, " doesn't match\n");
|
|
320 | 320 |
char colors = 0;
|
321 | 321 |
int verbose = 0;
|
322 | 322 |
double offset_show = -1.0;
|
|
323 |
char show_ts = 0;
|
323 | 324 |
|
324 | 325 |
static struct option long_options[] =
|
325 | 326 |
{
|
|
365 | 366 |
{"offset-red", 1, NULL, 2 },
|
366 | 367 |
{"offset-show", 1, NULL, 3 },
|
367 | 368 |
{"show-offset", 1, NULL, 3 },
|
|
369 |
{"timestamp", 0, NULL, 4 },
|
|
370 |
{"ts", 0, NULL, 4 },
|
368 | 371 |
{"version", 0, NULL, 'V' },
|
369 | 372 |
{"help", 0, NULL, 'H' },
|
370 | 373 |
{NULL, 0, NULL, 0 }
|
|
395 | 398 |
|
396 | 399 |
case 3:
|
397 | 400 |
offset_show = atof(optarg);
|
|
401 |
break;
|
|
402 |
|
|
403 |
case 4:
|
|
404 |
show_ts = 1;
|
398 | 405 |
break;
|
399 | 406 |
|
400 | 407 |
case 'Y':
|
|
1255 | 1262 |
char *operation = !persistent_connections ? "connected to" : "pinged host";
|
1256 | 1263 |
const char *sep = c_bright, *unsep = c_normal;
|
1257 | 1264 |
|
|
1265 |
if (show_ts)
|
|
1266 |
{
|
|
1267 |
struct timeval tv;
|
|
1268 |
|
|
1269 |
(void)gettimeofday(&tv, NULL);
|
|
1270 |
|
|
1271 |
struct tm *tvm = localtime(&tv.tv_sec);
|
|
1272 |
|
|
1273 |
if (verbose)
|
|
1274 |
printf("%04d/%02d/%02d ", tvm -> tm_year + 1900, tvm -> tm_mon + 1, tvm -> tm_mday);
|
|
1275 |
|
|
1276 |
printf("%02d:%02d:%02d.%03d ", tvm -> tm_hour, tvm -> tm_min, tvm -> tm_sec, (int)(tv.tv_usec / 1000));
|
|
1277 |
}
|
|
1278 |
|
1258 | 1279 |
if (curncount & 1)
|
1259 | 1280 |
{
|
1260 | 1281 |
printf("%s", c_bright);
|