The example shows the usage of an UDP socket, and this works. But finally, the received time (seconds sind 1970) prints the correct date only by sudden. https://github.com/ARMmbed/mbed-os-snippet-UDPSocket/blob/18ae5c765b96ca5bcfd9c584c7cc776ff3ef0867/main.cpp#L48 There is a typecast from a 4 byte to an 8 byte pointer, this works only when the upper 4 bytes are zero. This is a fix for this (PRs doesnt seem to be used): ``` time_t now = in_data.secs; printf("Time = %s", ctime(&now)); ```
The example shows the usage of an UDP socket, and this works. But finally, the received time (seconds sind 1970) prints the correct date only by sudden.
https://github.com/ARMmbed/mbed-os-snippet-UDPSocket/blob/18ae5c765b96ca5bcfd9c584c7cc776ff3ef0867/main.cpp#L48
There is a typecast from a 4 byte to an 8 byte pointer, this works only when the upper 4 bytes are zero.
This is a fix for this (PRs doesnt seem to be used):