Giter VIP home page Giter VIP logo

Comments (7)

leroycep avatar leroycep commented on July 23, 2024 2

I've gone ahead and updated it to work with version 0.11.0 of Zig, feel free to try it out. I haven't tried out the standard library TZif parser, so I can't offer any comparison at the moment.

I also have a partial port of the rust chrono library done, but I'm not sure it translates super well from rust. There have been other people working on datetime handling in Zig, but again I haven't really used them myself.

from zig-tzif.

leroycep avatar leroycep commented on July 23, 2024 1

I hadn't considered it before, but I'm not opposed. I think when I initially wrote this I assumed that Zig was going in the same direction as Rust with std/third-party libraries, but if there's a TZif parser in the standard library, I see no reason it shouldn't support Posix TZ as well.

from zig-tzif.

leroycep avatar leroycep commented on July 23, 2024

It is not active at the moment, I wouldn't mind updating it or adding a small feature or two though.

from zig-tzif.

FObersteiner avatar FObersteiner commented on July 23, 2024

I've gone ahead and updated it to work with version 0.11.0 of Zig, feel free to try it out. I haven't tried out the standard library TZif parser, so I can't offer any comparison at the moment.

Thanks a lot, I will sure give it a try :)

Regarding the TZif parser in the standard library, I'm not sure I understand why it's in the standard lib in the first place 👾 Anyhow, I played around with it, works quite well. But it doesn't handle the footer of the v2+ files, which is important I think since AFAIK, current TZif files do not make use of the 64 bit range. Transition times span basically the same range as the v1 files. Although that could of course be extended in the future. And of course for many time zones, there simply are no transition times (no DST), so you have to use the posix rule if I didn't miss anything.

from zig-tzif.

FObersteiner avatar FObersteiner commented on July 23, 2024

@leroycep did you consider contributing the POSIX TZ parser to the Zig standard library?
I mean, there's a TZif parser in https://github.com/ziglang/zig/blob/master/lib/std/tz.zig, but it only extracts the footer, it doesn't parse it. That makes it incomplete and partly useless in my eyes - many time zones rely on that rule, not only in the far future. I haven't been observing the Zig ecosystem for long, so not sure if the core team removes stuff from std, i.e. if there's a chance they will remove tz. Probably depends on which part of Zig is using it (I have not investigated). I found this PR which introduced tz almost 2 years ago (Jan 2022), and it seems the original plan was to add datetime/calendar functionality. Since that did not happen so far, I guess this is not exactly top priority.

Anyways, adding POSIX TZ parser to std.tz might be worth at least a try, after all the work you put into it?

from zig-tzif.

leroycep avatar leroycep commented on July 23, 2024

Following up on #9, I've gone ahead and revived the chrono-zig project: https://codeberg.org/geemili/chrono-zig

I've copied the changes we recently made in this repository into the chrono-zig repo, and I've implemented the algorithms described by Howard Hinnant. There's an example that prints out the local date and time.

from zig-tzif.

FObersteiner avatar FObersteiner commented on July 23, 2024

Nice, thanks for letting me know. And you moved it to codeberg :)

from zig-tzif.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.