NuxiNL / cloudlibc

CloudABI's standard C library
BSD 2-Clause "Simplified" License
296 stars 17 forks source link

localtime_l and mktime_l in a independent shared library #8

Open CurlyMoo opened 6 years ago

CurlyMoo commented 6 years ago

I'm curious what you think about the idea to release localtime_l and mktime_l as two functions in a independent shared library. Until today, i have not found a good library that does what these functions do, purely converting between timezones based on the IANA timezone database.

Because such a library does not exists, i integrated your localtime_l code inside my own program, but that requires (as you do now) a new release as soon as the IANA database is updated. If these functions would exist in a independent shared library, that update mechanism would be far easier, by just updating the shared library.

I also think a lot of C developers would be interested in these two functions alone without having to use the full cloudlibc library.

EdSchouten commented 6 years ago

Hi there! Great to hear there's interest in this code! \o/

This sounds like a good idea. I would love to keep them integrated in the C library in CloudABI's case, but if we could somehow make it so that I can just put an unmodified copy of this in contrib/ and link that into the C library, that would be fine by me.

Right now these functions are somewhat tied into cloudlibc's localisation framework (through newlocale(LC_TIMEZONE_MASK)). When moving this into a separate library, we'd better create a separate type for the time zone handle. In the case of cloudlibc, locale_t could be adjusted to embed this handle.

Is this something that you've already taken a stab at solving, or shall I go ahead and create a repo under NuxiNL for us to work on this?

CurlyMoo commented 6 years ago

Is this something that you've already taken a stab at solving, or shall I go ahead and create a repo under NuxiNL for us to work on this?

Yes, i already extracted the core of localtime_l so i can use it independently. I did alter it a bit to make it crossplatform (Windows, Linux, FreeBSD). A new repo would be great.

sdalu commented 3 years ago

It would be very nice to have it in a separate code/library so it could also be used in embedded system.

EdSchouten commented 3 years ago

This project is no longer maintained. Feel free to fork this code. 👍