I only skimmed this so pardon if this has been said before, or if it isn’t exactly a problem.
also I use timex in a Nerves application, which pulls in the tzdata application. These are my only experiences with time libraries in Elixir other than the stdlib.
Firstly, i would love for stdlib to have timezone support, because that is the only reason i use/need timex. (I try not to use deps unless i really need them due to various constraints).
However, syncing the timezone database is something a little weird. tzdata downloads the package on a timer of some sort and writes it to disk. From what i know about the elixir stdlib, and a quick poke thru :observer, i don’t think there is anything else that does anything to this extent right now.
obviously defining a @behaviour as described above would alleviate this to some extent, even so i think implementing this at the stdlib level would be a little difficult and messy to cover all situations. (thinking from a Nerves point of view where the filesystem is read only, and network is not guaranteed.)
anyway sorry for that longwinded post, just wanted to express that blurb while this is being discussed.
That’s why we don’t want to implement it in stdlib we want to define how a provider of time zone info should look like, so third party libraries can provide it, while the stdlib can offer functions that use it (and would error if no provider is specified). So you could have a nerves-specific provider that does something special.
Similar here. The stdlib doesn’t care how the provider gets the info - it might sync it in the cluster, sync it with some external resources (like current tzdata does) or compile it into modules (like old tzdata does) or do something I cant even think of right now.
As stated in the original post, this is not the thing we should be discussing here. How the provider will obtain the time zone database is beyond the scope of this discussion. We want only to explore what functions would require the time zone information and what would be the best interface for a library to expose it to stdlib.
I have made a proposal that includes a behaviour and Elixir code that uses it, so that DateTime functions can be used to get the time in any time one and convert between timezones: https://github.com/elixir-lang/elixir/pull/7914