From 6fdb97457029a88df0f01cea1ccb472490aec8a0 Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Thu, 18 Aug 2005 12:55:01 +0000 Subject: From Richard van der Hoff negative relative time fixes. svn path=/trunk/; revision=15407 --- epan/ftypes/ftype-time.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'epan/ftypes/ftype-time.c') diff --git a/epan/ftypes/ftype-time.c b/epan/ftypes/ftype-time.c index 582e42987f..ed90960952 100644 --- a/epan/ftypes/ftype-time.c +++ b/epan/ftypes/ftype-time.c @@ -170,9 +170,15 @@ static gboolean relative_val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFunc logfunc) { char *curptr, *endptr; - + gboolean negative = FALSE; + curptr = s; + if(*curptr == '-') { + negative = TRUE; + curptr++; + } + /* * If it doesn't begin with ".", it should contain a seconds * value. @@ -212,9 +218,10 @@ relative_val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _ fv->value.time.nsecs = 0; } - /* - * XXX - what about negative values? - */ + if(negative) { + fv->value.time.secs = -fv->value.time.secs; + fv->value.time.nsecs = -fv->value.time.nsecs; + } return TRUE; fail: -- cgit v1.2.3