From: Philippe Proulx Date: Wed, 16 Mar 2016 00:44:27 +0000 (-0400) Subject: Fix: config: timestamp_begin and timestamp_end must be mapped to the same clock X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=e4ac07c802f5f395218ceb6c09f2007209eaeff8;p=deliverable%2Fbarectf.git Fix: config: timestamp_begin and timestamp_end must be mapped to the same clock Signed-off-by: Philippe Proulx --- diff --git a/barectf/config.py b/barectf/config.py index c088310..7c173f9 100644 --- a/barectf/config.py +++ b/barectf/config.py @@ -401,6 +401,8 @@ class _MetadataSpecialFieldsValidator: # "timestamp_begin", if exists, is an unsigned integer type, # mapped to a clock + ts_begin = None + if 'timestamp_begin' in t.fields: ts_begin = t.fields['timestamp_begin'] @@ -415,6 +417,8 @@ class _MetadataSpecialFieldsValidator: # "timestamp_end", if exists, is an unsigned integer type, # mapped to a clock + ts_end = None + if 'timestamp_end' in t.fields: ts_end = t.fields['timestamp_end'] @@ -431,6 +435,11 @@ class _MetadataSpecialFieldsValidator: if (('timestamp_begin' in t.fields) ^ ('timestamp_end' in t.fields)): raise ConfigError('"timestamp_begin" and "timestamp_end" fields must be defined together in stream packet context type') + # "timestamp_begin" and "timestamp_end" are mapped to the same clock + if ts_begin is not None and ts_end is not None: + if ts_begin.property_mappings[0].object.name != ts_end.property_mappings[0].object.name: + raise ConfigError('"timestamp_begin" and "timestamp_end" fields must be mapped to the same clock object in stream packet context type') + # "events_discarded", if exists, is an unsigned integer type if 'events_discarded' in t.fields: events_discarded = t.fields['events_discarded']