indexing description: "[ Event that contains time information. This might be sent as response of a EM_NET_TIME_SYNC_REQUEST. ]" date: "$Date$" revision: "$Revision$" class EM_NET_TIME_SYNC_RESPONSE inherit EM_NET_EVENT_OBJECT create {EM_NET_OBJECT_TYPES} make_set_type feature -- Serialization serialize (a_serializer: EM_NET_SERIALIZER) is -- Serialize to the given stream using `a_serializer'. do if request_id >= 0 then a_serializer.put_integer_8 (request_id.to_integer_8) else a_serializer.put_integer_8 (- request_id.to_integer_8) end a_serializer.put_integer (time) end serialization_byte_count: INTEGER is -- Count of bytes needed for a successful serialization do Result := 5 end unserialize (an_unserializer: EM_NET_UNSERIALIZER) is -- Unserialize from a given stream using `an_unserializer'. do an_unserializer.read_integer_8 request_id := an_unserializer.last_integer.to_integer_8 if request_id >= 0 then is_from_master_node := False request_id := request_id.abs end an_unserializer.read_integer time := an_unserializer.last_integer end feature -- Element change set_request_id(a_request_id: INTEGER) is -- Set `request_id' to `a_request_id'. require a_request_id_in_defined_range: a_request_id >= 0 and a_request_id <= 127 do request_id := a_request_id ensure request_id_set: request_id = a_request_id end set_time(a_time: INTEGER) is -- Set `time' to `a_time'. require a_time_in_defined_range: a_time >= 0 do time := a_time ensure time_set: time = a_time end set_is_from_master_node(a_value: BOOLEAN) is -- Set `is_from_master_node' to `a_value'. do is_from_master_node := a_value ensure is_from_master_node_set: is_from_master_node = a_value end feature -- Information is_from_master_node: BOOLEAN -- Is this response from a time master node? -- This becomes useful if you want to develop p2p networks with time synchronisation. time: INTEGER -- Time request_id: INTEGER -- Request ID -- This helps to avoid wrong time measurements. -- Each request gets it's ID so multiple request cannot accidently interlace. feature {NONE} -- Implementation invariant invariant_clause: True -- Your invariant here end