Cyytrus
Currently, Elixir relies on :timer from Erlang’s stdlib. However, in every company I’ve worked at, I’ve noticed developers manually calculating milliseconds rather than using this library. This results in code that’s harder to read and less semantically clear.
This makes me wonder: why hasn’t :timer been ported to Elixir? Is there community interest in having a native Elixir timer module? I’m seriously considering opening a PR to implement it, but I’d like to understand if there are technical or philosophical reasons it hasn’t been done yet.
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
The obligatory hello world thread!
Who are you and where are you from? :stuck_out_tongue:
New
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog
It says that Fly is going all-in on sprites, which is a worry ...
New
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using.
We’re particularly inte...
New
Is there a word for the ~> symbol used in Version strings?
Do you also just call it a Squiggle Arrow™ ?!
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
kevinschweikert
Welcome! Since 1.17 there’s Kernel.to_timeout/1 which should make calculating milliseconds obsolete
jswanner
Welcome @Cyytrus!
There is a recent addition to Elixir to turn durations to milliseconds: Kernel — Elixir v1.20.2
Separately, since we can use Erlang functions directly, there’s no need to port things to Elixir unless something is going to be improved in the process (like developer ergonomics)
LostKobrakai
Besides the other answers: Erlang modules are generally not „ported“ just for the sake of a port existing. You can call erlang modules just fine, please do so. No need for a shallow port. The new
to_timeoutfor example exists to integrate with the new elixir duration definition handling.BartOtten
There is of course the split of documentation and as such less knowledge of erlang modules. So I do see use in shallow copies.
dimitarvp
I agree that’s a real problem and have been bitten by it a good amount of times. But I started seeing it as a “git gud” thing. We can’t constantly duplicate code for surface conveniences. API reshaping, using different contracts, hell, even swapping function argument positions so we can do Elixir pipes, all those are somewhat valid scenarios for introducing shims / wrappers. But just because I or somebody else has not tried to look if Erlang stdlib can help them? I’d say it’s not needed then.
hauleth
The same can be said about any function in any library. I do not think that “having single place to search for documentation” is valid argument for maintenance burden of wrapping everything.
sodapopcan
Ya, seems more like a need for better cross-document searching. Easy to say, harder to do, though. I confess that even though I’m all-for not-shallow wrapping, I almost never think to look in the Erlang docs if I can’t find an Elixir function
hauleth
For that I highly suggest Dash on macOS (or equivalent like DevDocs.io or Zeal). That provides you offline docs search ad you can add all docs you need.
BartOtten
That I do see use is not to say I advocate for shim libs. After all: where to stop, who keeps them up to date, do we adapt to Elixir conventions, will we use opt lists or maps etc etc.
On the other hand: the need to point to Erlang stdlib it’s not that great. The user suddenly has to know ‘their’ conventions, their doc system and ask questions about it at erlangforums.
brkn
Keeping it up to date might not be hard. I checked the commit history of erlang’s timer module, it has 12 commits that change source code for the last 5 years (I’m counting very liberally, spec and doc changes are included). Most of them are tiny.