Changeset dadc609


Ignore:
Timestamp:
06/01/04 09:22:05 (17 years ago)
Author:
Daniel Lawson <dlawson@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
c792590
Parents:
63a2713
Message:

fixed get_timeval to return a correct tv from ERF type records

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    r63a2713 rdadc609  
    687687        struct pcap_pkthdr *pcapptr = 0;
    688688        uint64_t ts;
     689        uint32_t seconds;
    689690        switch (libtrace->format) {
    690691                case PCAPINT:
     
    699700                case RTCLIENT:
    700701                default:
     702                        // FIXME: This isn't portable to big-endian machines
    701703                        ts = get_erf_timestamp(libtrace,buffer,buflen);
    702                         tv.tv_sec = ts >> 32;
    703                         tv.tv_usec = ((long)ts)*1000000/UINT_MAX;
     704                        tv.tv_sec = ts >> 32;           
     705                        ts = (1000000 * (ts & 0xffffffffULL));
     706                        ts += (ts & 0x80000000ULL) << 1;
     707                        tv.tv_usec = ts >> 32;
     708                        if (tv.tv_usec >= 1000000) {
     709                                tv.tv_usec -= 1000000;
     710                                tv.tv_sec += 1;
     711                        }
    704712                        break;
    705713        }
Note: See TracChangeset for help on using the changeset viewer.