From Richard van der Hoff
authorAnders Broman <anders.broman@ericsson.com>
Thu, 18 Aug 2005 12:55:01 +0000 (12:55 -0000)
committerAnders Broman <anders.broman@ericsson.com>
Thu, 18 Aug 2005 12:55:01 +0000 (12:55 -0000)
negative relative time fixes.

svn path=/trunk/; revision=15407

epan/ftypes/ftype-time.c

index 582e42987fc1728499554f7176e66d602d2b3372..ed90960952652398b0aba0a9614efef3c6d48667 100644 (file)
@@ -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: