MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bpf_bintime2ts

Function bpf_bintime2ts

freebsd/net/bpf.c:2435–2464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2433}
2434
2435static void
2436bpf_bintime2ts(struct bintime *bt, struct bpf_ts *ts, int tstype)
2437{
2438 struct bintime bt2, boottimebin;
2439 struct timeval tsm;
2440 struct timespec tsn;
2441
2442 if ((tstype & BPF_T_MONOTONIC) == 0) {
2443 bt2 = *bt;
2444 getboottimebin(&boottimebin);
2445 bintime_add(&bt2, &boottimebin);
2446 bt = &bt2;
2447 }
2448 switch (BPF_T_FORMAT(tstype)) {
2449 case BPF_T_MICROTIME:
2450 bintime2timeval(bt, &tsm);
2451 ts->bt_sec = tsm.tv_sec;
2452 ts->bt_frac = tsm.tv_usec;
2453 break;
2454 case BPF_T_NANOTIME:
2455 bintime2timespec(bt, &tsn);
2456 ts->bt_sec = tsn.tv_sec;
2457 ts->bt_frac = tsn.tv_nsec;
2458 break;
2459 case BPF_T_BINTIME:
2460 ts->bt_sec = bt->sec;
2461 ts->bt_frac = bt->frac;
2462 break;
2463 }
2464}
2465
2466/*
2467 * Move the packet data from interface memory (pkt) into the

Callers 1

catchpacketFunction · 0.85

Calls 4

getboottimebinFunction · 0.85
bintime_addFunction · 0.85
bintime2timevalFunction · 0.85
bintime2timespecFunction · 0.85

Tested by

no test coverage detected