aboutsummaryrefslogtreecommitdiffstats
path: root/epan/nstime.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2007-11-20 18:35:41 +0000
committerGerald Combs <gerald@wireshark.org>2007-11-20 18:35:41 +0000
commitdfb104544f3eba323167b74a8fbe058455cc2a70 (patch)
tree21d6af3d6c0084f57dd12c90a7e32993219ba300 /epan/nstime.c
parent06f0070947a21f5f261210d134f0182b19fe1734 (diff)
Add relative start time, duration, and average data rate (bps) columns
to the conversation lists. Move the "copy" button down to the button bar in order to free up some real estate. Add an nstime_cmp() function. Clean up code in a few places. svn path=/trunk/; revision=23516
Diffstat (limited to 'epan/nstime.c')
-rw-r--r--epan/nstime.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/epan/nstime.c b/epan/nstime.c
index e1b27f6759..b913947bdf 100644
--- a/epan/nstime.c
+++ b/epan/nstime.c
@@ -2,7 +2,7 @@
* Routines for manipulating nstime_t structures
*
* Copyright (c) 2005 MX Telecom Ltd. <richardv@mxtelecom.com>
- *
+ *
* $Id$
*
* Wireshark - Network traffic analyzer
@@ -13,12 +13,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -127,7 +127,24 @@ void nstime_sum(nstime_t *sum, const nstime_t *a, const nstime_t *b)
} else if(sum->nsecs<=-NS_PER_S || (sum->nsecs<0 && sum->secs>0)) {
sum->nsecs+=NS_PER_S;
sum->secs--;
- }
+ }
+}
+
+/*
+ * function: nstime_cmp
+ *
+ * a > b : > 0
+ * a = b : 0
+ * a < b : < 0
+ */
+
+int nstime_cmp (nstime_t *a, const nstime_t *b )
+{
+ if (a->secs == b->secs) {
+ return a->nsecs - b->nsecs;
+ } else {
+ return (int) (a->secs - b->secs);
+ }
}
/*
@@ -159,3 +176,17 @@ double wtap_nstime_to_sec(const struct wtap_nstime *time)
{
return ((double)time->secs + (double)time->nsecs/1000000000);
}
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
+