diff options
author | Guy Harris <guy@alum.mit.edu> | 2005-08-20 02:15:02 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2005-08-20 02:15:02 +0000 |
commit | e5c09b21aaecfab7b37d041065d65a5f8cb1cbda (patch) | |
tree | a9ba8e6470498037cf645b67d7b36fdbeb7ecaf1 | |
parent | 53b54d11ed45c44aac2d45d81580a40fb5b00a0f (diff) |
Use get_timedelta() to get the difference between two times.
svn path=/trunk/; revision=15455
-rw-r--r-- | epan/dissectors/packet-smb.c | 13 | ||||
-rw-r--r-- | tap-smbstat.c | 13 |
2 files changed, 10 insertions, 16 deletions
diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index c8bb5e3030..245bfd6670 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -14727,7 +14727,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) guint16 errcode = 0; guint32 pid_mid; conversation_t *conversation; - nstime_t ns; + nstime_t t, deltat; si_counter++; if(si_counter>=20){ @@ -15063,14 +15063,11 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) if (sip->frame_req != 0) { tmp_item=proto_tree_add_uint(htree, hf_smb_response_to, tvb, 0, 0, sip->frame_req); PROTO_ITEM_SET_GENERATED(tmp_item); - ns.secs = pinfo->fd->abs_secs - sip->req_time.secs; - ns.nsecs = pinfo->fd->abs_usecs*1000 - sip->req_time.nsecs; - if(ns.nsecs<0){ - ns.nsecs+=1000000000; - ns.secs--; - } + t.secs = pinfo->fd->abs_secs; + t.nsecs = pinfo->fd->abs_usecs*1000; + get_timedelta(&deltat, &t, &sip->req_time); tmp_item=proto_tree_add_time(htree, hf_smb_time, tvb, - 0, 0, &ns); + 0, 0, &deltat); PROTO_ITEM_SET_GENERATED(tmp_item); } } diff --git a/tap-smbstat.c b/tap-smbstat.c index a2e2a32e0d..9c7d707349 100644 --- a/tap-smbstat.c +++ b/tap-smbstat.c @@ -56,7 +56,7 @@ smbstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const voi { smbstat_t *ss=(smbstat_t *)pss; const smb_info_t *si=psi; - nstime_t delta; + nstime_t t, deltat; timestat_t *sp=NULL; /* we are only interested in reply packets */ @@ -87,15 +87,12 @@ smbstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const voi } /* calculate time delta between request and reply */ - delta.secs=pinfo->fd->abs_secs-si->sip->req_time.secs; - delta.nsecs=pinfo->fd->abs_usecs*1000-si->sip->req_time.nsecs; - if(delta.nsecs<0){ - delta.nsecs+=1000000000; - delta.secs--; - } + t.secs=pinfo->fd->abs_secs; + t.nsecs=pinfo->fd->abs_usecs*1000; + get_timedelta(&deltat, &t, &si->sip->req_time); if(sp){ - time_stat_update(sp,&delta, pinfo); + time_stat_update(sp,&deltat, pinfo); } return 1; |