Here is mije from UDP/NTP time protocol I needed it for NTP time.
' Routine to convert the LONG from the NTP-server in to date and time'SubENC28J60_NTPdiml1aslongDIML2ASlongL1=T_udp_data3L1_H=T_udp_data2L1_U=T_udp_data1L1_E=T_udp_data0L1=L1-[Long]3660595200L1=L1+[LONG]3600' offset UTC - 1 hour HserPrint "Date " l2 = ( l1 / 86400 ) + 1 HSerPrint l2 'Needtoresolveleapyears.isleap(l1/31536000)' for ii = 1 to 365 + isleap( l1 / 31536000 )'''nextl2=l1/31536000'yearl2=l2+2016HSerPrint"D/"HSerPrintl2HSerPrintCRLFHserPrint"Time "l2=L1%86400l2=l2/3600ifl2<10thenHSerPrint"0"HSerPrintl2HSerPrint":"l2=L1%3600l2=l2/60ifl2<10thenHSerPrint"0"HSerPrintl2l2=L1%[LONG]60HSerPrint":"ifl2<10thenHSerPrint"0"HSerPrintl2HSerPrintCRLFEndSub
Some long number is in T_udp_data() which is loaded into L1. Magic calcs.... the time.
I would lift the code from the NTP protocol.
Last edit: Anobium 2023-03-30
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there an instruction or algorithm that transforms time and date into unix format and vice-versa?
Here is mije from UDP/NTP time protocol I needed it for NTP time.
Some long number is in T_udp_data() which is loaded into L1. Magic calcs.... the time.
I would lift the code from the NTP protocol.
Last edit: Anobium 2023-03-30