public static SystemTimeDTO createSystemTimeDTO(SystemTime source) { if (null == source) { return(null); } SystemTimeDTO result = new SystemTimeDTO(); Utilities.CopySimilar.CopyAll(source, result); return(result); }
public void CheckSystemTimeObject() { MAVLink.mavlink_system_time_t timeStruct = new MAVLink.mavlink_system_time_t(); timeStruct.time_boot_ms = 1; timeStruct.time_unix_usec = 2; MavLinkMessage message = createSampleMessage(MAVLink.MAVLINK_MSG_ID.SYSTEM_TIME, timeStruct); SystemTime systemTime = new SystemTime(message); Assert.AreEqual(timeStruct.time_boot_ms, systemTime.time_boot_ms); Assert.AreEqual(timeStruct.time_unix_usec, systemTime.time_unix_sec); SystemTimeDTO dto = DTOFactory.createSystemTimeDTO(systemTime); Assert.AreEqual(dto.time_boot_ms, systemTime.time_boot_ms); Assert.AreEqual(dto.time_unix_sec, systemTime.time_unix_sec); String json = JsonConvert.SerializeObject(dto); }