| 190 | } |
| 191 | |
| 192 | static char * |
| 193 | fmt_time(char *buf, size_t size, uint64_t ts_ns) |
| 194 | { |
| 195 | time_t sec; |
| 196 | size_t len; |
| 197 | |
| 198 | sec = ts_ns / NS_PER_S; |
| 199 | len = strftime(buf, size, "%X", localtime(&sec)); |
| 200 | snprintf(buf + len, size - len, ".%09lu", |
| 201 | (unsigned long)(ts_ns % NS_PER_S)); |
| 202 | |
| 203 | return buf; |
| 204 | } |
| 205 | |
| 206 | /* Context for the pcap_loop callback */ |
| 207 | struct pkt_print_ctx { |
no test coverage detected