#https://mpython.readthedocs.io/en/master/library/micropython/ntptime.html
import ntptime,time
def poveži_se():
    import network
    sta_if = network.WLAN(network.STA_IF)
    if not sta_if.isconnected():
        print('priklapljam se na mrežo...')
        sta_if.active(True)
        sta_if.connect('pi', 'raspberry')
        while not sta_if.isconnected():
            pass
    print('mrežna nastavitev:', sta_if.ifconfig())

poveži_se()
print("Local time before synchronization：%s" %str(time.localtime()))
ntptime.settime()
print("Local time after synchronization：%s" %str(time.localtime()))
