Project

General

Profile

Actions

Bug #5865

closed

snoop prints timestamps oddly

Added by David Pacheco over 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
2015-04-23
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:
External Bug:

Description

With "snoop -t a", snoop prints absolute timestamps like "15:15:5.58921", which is missing the leading zero on the number of seconds. This isn't the way most software prints timestamps, and it makes all sorts of output not line up.

I believe the problem is in show_pktinfo in snoop.c, where the code does this:

 583         if (flags & F_TIME) {
 584                 if (flags & F_ATIME) {
 585                         (void) sprintf(lp, "%d:%02d:%d.%05d ",
 586                                 tm->tm_hour, tm->tm_min, tm->tm_sec,
 587                                 (int)tvp->tv_usec / 10);
 588                         lp += strlen(lp);

We should probably just use strftime(3C) here.

Actions

Also available in: Atom PDF