Topic: Porting timeval Structure To NXP MQX

Hello,
I am trying to port wolfMQTT to an NXP processor running the MQX v4.2 OS.  The compiler is telling me that file mqttnet.c needs a structure "timeval" ('error: dereferencing pointer to incomplete type').  I made one up (what I THINK it wants) and put it in the file:

struct timeval {
    int tv_sec;
    int tv_usec;
}

The error goes away.  But do I need to increment/decrement those structure variables based on time or does wolfMQTT handle that?  Thank you.

Share

Re: Porting timeval Structure To NXP MQX

Hi kackle123,

The `struct timeval` is used in wolfMQTT for socket timeout handling. If you do define `struct timeval` you don't need to increment it. The structure is used for `select()` to define the time to wait before timing out. Since the build works it means your socket layer handles `select()`, so you are good to go.

If you want to bypass setting a socket timeout in the mqttnet.c example code you can define `WOLFMQTT_NO_TIMEOUT`.

Thanks,
David Garske, wolfSSL

Share

Re: Porting timeval Structure To NXP MQX

Thank you; I'll see how it goes.

Share