// The modbus_get_response_timeout() function shall return the timeout interval used to wait for a response in the to_sec and to_usec arguments. func (this *RtuConnection) Get_response_timeout() (time.Duration, error) { var to_sec, to_usec C.uint32_t res, errno := C.modbus_get_response_timeout(this.ctx, &to_sec, &to_usec) if int(res) == 0 { return time.Duration(to_sec)*time.Second + time.Duration(to_usec)*time.Microsecond, nil } else { return 0, errors.New(modbus_strerror(errno)) } }
func (this ModbusRTUConnection) Timeout() time.Duration { var sec, usec C.uint32_t C.modbus_get_response_timeout(this.ctx, &sec, &usec) return time.Duration(sec)*time.Second + time.Duration(usec)*time.Microsecond }