linux-BR.org

Notícias de software livre e tecnologias

https://orbstack.dev/ ↩︎
https://www.wireshark.org/ ↩︎
https://datatracker.ietf.org/doc/html/rfc1035#section-4.1.2 ↩︎
https://datatracker.ietf.org/doc/html/rfc5905#:~:text=as%20follows%3a%0a%0a%20%20li-lap%20indicator ,-(leap)%2dbit ↩︎ ↩︎
https://datatracker.ietf.org/doc/html/rfc5905#section-7.3:~:text=leap%20Indicator%0A%0A%20%20%20VN-Iversion%20Number ,-(version)203%2dbit ↩︎ ↩︎
https://datatracker.ietf.org/doc/html/rfc5905#section-7.3:~:text=number%2c%20%20%2044i↩︎ ↩︎
https://datatracker.ietf.org/doc/html/rfc5905#section-7.3:~:text=10%3A%20association%20Modes -,Sstratum%20(stratum),-%3A%208DBIT %20Integer ↩︎20↩︎
https://datatracker.ietf.org/doc/html/rfc5905#section-7.3:~:text=for%20an%20Example ).-,poll.-%3a%208%2Dbit%20Signed ↩︎ ↩︎
https://datatracker.ietf.org/doc/html/rfc5905#section-7.3:~:text=and%2010%2C%20Respectivamente. -precision.-%3A%208DBIT%20Signed ↩︎ ↩︎
20%20%20%20%20June%202010-, raiz%20Delay,-(ROOTDELAY)%3a%20total%20Round ↩︎ ↩︎ ↩︎ ↩︎
https://datatracker.ietf.org/doc/html/rfc5905#section-7.3:~:text=ntp%20short%20Format.- ,root%20DisperSion ,-(rootdisp)%20Total%20Dispersion ↩︎
https://datatracker.ietf.org/doc/html/rfc5905#section-7.3:~:text=ntp%20short%20format.-, reference%20id ,-(refid)%3A%2032dbit ↩︎ ↩︎ ↩︎
https://datatracker.ietf.org/doc/html/rfc5905#section-7.3:~:text=not%20be%20Detected.-, reference%20TimeSTamp.-%3Aprime Tempora de nota%20The ↩︎ ↩︎ ↩︎
https://datatracker.ietf.org/doc/html/rfc5905#section-7.3:~:text=ntp%20timestamp%20format.-, ↩︎120timestamp ,-(org)%20Time%20AT ↩︎ ↩︎
https://datatracker.ietf.org/doc/html/rfc5905#section-7.3:~:text=ntp%20timestamp%20format.-,receive%20timestamp ,-(rec)%20Time%20AT ↩︎ ↩︎
https://datatracker.ietf.org/doc/html/rfc5905#section-7.3:~:text=ntp%20timestamp%20format.-,ransmit%20timestamp ,-(xmt)
https://datatracker.ietf.org/doc/html/rfc5905#section-16 ↩︎ ↩︎
https://www.erlang.org/doc/man/gen_udp.html#open-2 ↩︎
https://www.erlang.org/doc/man/gen_udp.html#recv-2 ↩︎
https://www.erlang.org/doc/man/gen_udp.html#send-4 ↩︎
https://hexdocs.pm/elixir/1.15.3/genserver.html ↩︎
https://hexdocs.pm/elixir/1.15.3/dynamicsupervisor.html#start_link/1 ↩︎
https://hexdocs.pm/elixir/1.15.3/system.html#system_time/1 ↩︎
https://datatracker.ietf.org/doc/html/rfc5905#section-7.3:~:text=in%20the%20Date%20and%20Timestamp%20Formats%2C%20The%20Prime%20EPOCHOL2CO120or%20Base%2C%20the%20Prime%20EPOCHOL2COL20or%20Base20date%20of%0a%20%20%20era%200%2c%20is%200%20h%201%20January%201900%20utc%2c%20wen%20l%20bits%20e%20Zero.No Elixir, isso é muito fácil de extrair com a correspondência de padrões:
Na minha implementação, codificei o ID, então eu uso: << _ :: binário-size (40), Origin_timestamp :: binário >>.Todos os itens acima seriam algo assim em nosso código:
O que, por sua vez, faz com que nossa função Handle_Continue/2 se pareça:
Na implementação final, também adicionei alguns registros.Os sistemas baseados em UNIX, incluindo Linux e MacOS, usam 1º de janeiro de 1970, como a época (ponto de partida) para representar o tempo.Em seguida, temos 00, que é um relógio Stratum7 (fonte, GPS, relógio atômico, etc.)

Fonte: https://0x7f.dev/post/ntp-implementation-in-elixir/