diff options
author | Anders Broman <anders.broman@ericsson.com> | 2005-08-18 12:55:01 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2005-08-18 12:55:01 +0000 |
commit | 6fdb97457029a88df0f01cea1ccb472490aec8a0 (patch) | |
tree | a3346f8064003f23a40c2c37c6829808cd876aef /epan | |
parent | 913b6b22ec07d2d21863994baf67e6ca5caaaf07 (diff) |
From Richard van der Hoff
negative relative time fixes.
svn path=/trunk/; revision=15407
Diffstat (limited to 'epan')
-rw-r--r-- | epan/ftypes/ftype-time.c | 15 |
1 files changed, 11 insertions, 4 deletions
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: |