From e4ac07c802f5f395218ceb6c09f2007209eaeff8 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 15 Mar 2016 20:44:27 -0400 Subject: [PATCH] Fix: config: timestamp_begin and timestamp_end must be mapped to the same clock Signed-off-by: Philippe Proulx --- barectf/config.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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'] -- 2.34.1