4 ms·
We're developing a new date/time library from scratch for Hare. So far I think we're doing a pretty good job. The person leading up this effort (Byron Torres) h
by ddevault 4y ago
We're developing a new date/time library from scratch for Hare. So far I think we're doing a pretty good job. The person leading up this effort (Byron Torres) has written up a blog post about it here:
https://harelang.org/blog/2022-04-17-chronology-in-hare/ https://harelang.org/blog/2022-04-17-chronology-in-hare/
To stress test our implementation (and to flex on other languages), we're implementing Martian time in it as well.
https://harelang.org/blog/2022-08-01-martian-time-in-hare/ https://harelang.org/blog/2022-08-01-martian-time-in-hare/
// Hare's first commit.
let hare = mbc::new(chrono::MTC, 0, 0218,10,19, 09,20,53,344357297)!;
fmt::println(mbc::bsformat(buf, mbc::STELLAR, &hare)!)!;
// 0218 Perseus 19, Fri 09:20 MTC
My current litmus test goal for it is to get strftime to print out 23:23:60.
- macintux 4y agoSkimming through it I didn’t see my common question of such libraries: can it handle approximate dates? Twice in my career I’ve had to implement code to handle concepts like “August 2022”, or “1pm”, where it was important to track the level of precision offered by the source material for later comparisons. “1pm” is not the same as “1:00:00.000”, nor is “August 2022” the same as “20220801T00:00:00.000Z”.
- ddevault 4y agoI think that would be out of scope for the standard library. We do have an interface which might be helpful for developing such a tool, though: https://docs.harelang.org/datetime#builder https://docs.harelang.org/datetime#builder
- wruza 4y agoToo bad that most stdlibs outscope it to third parties. Wildcard periods are essential for some applications (even as simple as a periodic reminder) and also are hard to do correctly. I’d say a period is actually more important than a date, because we mostly work with periods, and our “datetimes” are just integer coordinates of pixels of time, so to say.
- ddevault 4y agoWell, Hare is not a high-level programming language, and the standard library has a specific, finite scope. It's also not generally used in the kinds of situations where this is called for (think C -- there's not really a similar library for C, either). But that's not to say it isn't important -- I definitely think that there should be a library which provides this.