News for hackers. Stuff that matters.
Re:NTP Implementation in Elixir by nubinetwork on Wednesday July 19, 2023 @02:24AM (#36782750)
Re:NTP Implementation in Elixir by signa11 on Wednesday July 19, 2023 @05:40AM (#36783961)
whoopsie ! not much discussion on that, perhaps we might see some action this time around.
Re:NTP Implementation in Elixir by nubinetwork on Wednesday July 19, 2023 @05:44AM (#36783980)
I'm sure you'll repost it another six times if not... /s
Re:NTP Implementation in Elixir by AlchemistCamp on Wednesday July 19, 2023 @05:51AM (#36784025)
It was submitted by a different person each time.
Re:NTP Implementation in Elixir by misnome on Wednesday July 19, 2023 @06:57AM (#36784460)
Calling dupe on a post in favour of one with no discussion just wastes everyones time.
Re:NTP Implementation in Elixir by xrd on Wednesday July 19, 2023 @07:40AM (#36784785)
This was a really fun read.

It's interesting to think about why the prior submission by the author himself didn't get any comments or traction and this resubmission did. Timing?

As of right now, there are really only two non-meta comments here after all. Which is too bad, this is a great write-up and very fun.

Re:NTP Implementation in Elixir by clone1018 on Wednesday July 19, 2023 @07:28AM (#36784698)
Really enjoy working with bits & bytes in Elixir. The syntax looks weird at first but pattern matching against an incoming message via individual bytes is very nice. I've found the gen_tcp / gen_udp stuff's documentation to be a little hard to grok as most of it only gives deep in the Erlang modules but once you "get it" you really get it. It plays very nicely with GenServer's too for super reliable, fault tolerant, tcp/udp acceptor clients. Thanks for the article, this will be a good resource for everyone to learn more about gen_tcp/udp directly!
Re:NTP Implementation in Elixir by whalesalad on Wednesday July 19, 2023 @09:50AM (#36786308)
My "learn elixir" project was writing a full API/client for communication with a NEO-M8 GPS chip via i2c bus. I have never done any i2c hardware programming in my life. Suffice to say I bit off way more than I can chew and it barely works - but it's definitely been incredibly rewarding to use such a high level language to do such low level things with relative ease.
Re:NTP Implementation in Elixir by giraffe_lady on Wednesday July 19, 2023 @10:16AM (#36786741)
Completely agreed, I had to reverse engineer and communicate with an undocumented telnet interface last year at work. It was a brutal pain until I decided to do it in elixir, where it was merely annoying.

The nomenclature around binary/bitstream/charlist/iolist is fairly messy though. But to be fair I think most or maybe all of that shit is just straight from erlang. OTP is a rock solid standard lib but we used to joke that they just took turns naming modules and functions. "Everyone gets to do one!" There's no consistency.

Re:NTP Implementation in Elixir by aeruder on Wednesday July 19, 2023 @07:31AM (#36784722)
I really like how well the pattern-matching system in Elixir works with decoding binary data. It can even extract on non-byte boundaries.
Re:NTP Implementation in Elixir by J_tt on Wednesday July 19, 2023 @09:36AM (#36786093)
What’s fantastic is you can reference an unpacked variable immediately within the bitstring.

This is super handy if you have variable length sections with a header, such as a DNS packet, saving having to do it in two operations.

Re:NTP Implementation in Elixir by ralphc on Wednesday July 19, 2023 @10:31AM (#36787001)
Compared to the bit packing I had to do in C in the 80s Elixir is a joy. The bit operations in a pattern-matched functional language is what got me hooked on Elixir.
Re:NTP Implementation in Elixir by gumby on Wednesday July 19, 2023 @11:11AM (#36787763)
I would think that a language like Elixir would have latency issues that would be a problem for NTP. I didn't see any discussion of this in the article -- can Elixir be deterministic?
Re:NTP Implementation in Elixir by aomix on Wednesday July 19, 2023 @12:14PM (#36788815)
Since the NTP client is usually just drifting towards the server time with clock skew maybe this would only manifest as doing this process a little slower. If latency was even a problem in the first place.