cloudlibc icon indicating copy to clipboard operation
cloudlibc copied to clipboard

localtime_l and mktime_l in a independent shared library

Open CurlyMoo opened this issue 7 years ago • 4 comments

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.

CurlyMoo avatar Aug 20 '17 14:08 CurlyMoo

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?

EdSchouten avatar Aug 20 '17 19:08 EdSchouten

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.

CurlyMoo avatar Aug 20 '17 20:08 CurlyMoo

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

sdalu avatar Sep 14 '20 15:09 sdalu

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

EdSchouten avatar Sep 14 '20 15:09 EdSchouten