From Richard van der Hoff:
[obnox/wireshark/wip.git] / timestats.c
index 5593c26d89de00b14c4b89357f2e7b5d1e7b2f9f..18c1c6f58b74a7e64161b5e8dc575de9a04f2d2e 100644 (file)
@@ -2,7 +2,7 @@
  * routines for time statistics
  * Copyrigth 2003 Lars Roland
  *
- * $Id: timestats.c,v 1.2 2003/09/03 10:10:17 sahlberg Exp $
+ * $Id$
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 
 #include "timestats.h"
 
-/*
- * function: get_timedelta
- * delta = b - a
- */
-
-void get_timedelta(nstime_t *delta, nstime_t *b, nstime_t *a )
-{
-       delta->secs = b->secs - a->secs;
-       delta->nsecs= b->nsecs - a->nsecs;
-       if(delta->nsecs<0){
-               delta->nsecs+=1000000000;
-               delta->secs--;
-       }
-}
-
-/*
- * function: addtime
- * sum += a
- */
-
-void addtime(nstime_t *sum, nstime_t *a)
-{
-       sum->secs += a->secs;
-       sum->nsecs += a->nsecs;
-       if(sum->nsecs>1000000000){
-               sum->nsecs-=1000000000;
-               sum->secs++;
-       }
-}
-
 /*
  * function: nstime_to_msec
  * converts nstime to gdouble, time base is milli seconds
  */
 
-gdouble nstime_to_msec(nstime_t *time)
+gdouble nstime_to_msec(const nstime_t *time)
 {
        return ((double)time->secs*1000 + (double)time->nsecs/1000000);
 }
@@ -68,7 +38,7 @@ gdouble nstime_to_msec(nstime_t *time)
 /* A Function to update a timestat_t struct with a new sample*/
 
 void
-time_stat_update(timestat_t *stats, nstime_t *delta, packet_info *pinfo)
+time_stat_update(timestat_t *stats, const nstime_t *delta, packet_info *pinfo)
 {
        if(stats->num==0){
                stats->max.secs=delta->secs;
@@ -115,7 +85,7 @@ time_stat_update(timestat_t *stats, nstime_t *delta, packet_info *pinfo)
  * returns the average as a gdouble , time base is milli seconds
  */
 
-gdouble get_average(nstime_t *sum, guint32 num)
+gdouble get_average(const nstime_t *sum, guint32 num)
 {
        gdouble average;