W5500-EVB-Pico set time with NTP

I can’t manage to sync time with NTP on the board RTC.

Has anyone had success with this. I’ve changed an available ntptime.py library to accommodate the lack of socket settimeout in the W5500 socket library and it works fine on a regular Pico-w, but does not work (no errors) on the W5500. Basically, res is always none after polling.

import utime
import uselect

    import usocket as socket
    import socket
    import ustruct as struct
    import struct

# The NTP host can be configured at runtime by doing: ntptime.host = 'myhost.org'
host = "pool.ntp.org"
# The NTP socket timeout can be configured at runtime by doing: ntptime.timeout = 2
timeout = 1

def time():
    NTP_QUERY = bytearray(48)
    NTP_QUERY[0] = 0x1B
    addr = socket.getaddrinfo(host, 123)[0][-1]
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        res = s.sendto(NTP_QUERY, addr)
        poller = uselect.poll() 
        poller.register(s, uselect.POLLIN) 
        res = poller.poll(1000)
        msg = s.recv(48)
    val = struct.unpack("!I", msg[40:44])[0]

    EPOCH_YEAR = utime.gmtime(0)[0]
    if EPOCH_YEAR == 2000:
        # (date(2000, 1, 1) - date(1900, 1, 1)).days * 24*60*60
        NTP_DELTA = 3155673600
    elif EPOCH_YEAR == 1970:
        # (date(1970, 1, 1) - date(1900, 1, 1)).days * 24*60*60
        NTP_DELTA = 2208988800
        raise Exception("Unsupported epoch: {}".format(EPOCH_YEAR))

    return val - NTP_DELTA

# There's currently no timezone support in MicroPython, and the RTC is set in UTC time.
def settime():
    t = time()
    import machine

    tm = utime.gmtime(t)
    machine.RTC().datetime((tm[0], tm[1], tm[2], tm[6] + 1, tm[3], tm[4], tm[5], 0))

I resolved this myself by hacking an existing ntptime.py client and adding functionality to also set the timezone and account for DST.