444 points · by burntsushi · 2w ago · 102 comments
Turns out, the reason people wanted to use it was because the API was stable and every slight step towards improvement was met with... resistance. I stopped maintaining it because the burnout from seeing what it could be and not seeing any path to get there was too much for me.
I'm extremely grateful to burntsushi for writing the datetime library rust deserves. Chrono is stable and is maintained (though semi-deprecated) by an extremely reliable rustacean -- you don't need to leave, but you'll probably be happier if you do.
Thank you so much for building something that was obviously good enough to sustain the community for 12 years <3
I've used it in several projects, and to me it seems just fine. Granted, I don't do a lot of cross-time zone work; I exclusively use UTC whenever possible.
(Putting my flame suit on here, but...) I think that's a good thing, and I wish this were the norm with more libraries in the open source world. Once you hit a stable version, breaking changes should happen approximately never. Improvements that need breaking changes should happen under a new name, with a new project, so that the old project can still exist and receive updates.
I still say SemVer has done more harm than good for the industry... it normalized the idea that "it's ok to break compatibility, just bump the major version" and then you have libraries on version 26 that break everything every time the author decides to feng shuei the code some more. Every major version bump should be thought of as a sort of "grave marker" indicating a place in history where the author messed up and had to admit the old design was literally broken, and every downstream dependent had to go through some amount of pain as a result. It shouldn't be normalized.
You can say "nobody's forcing you to upgrade" but, with the amount of vulnerabilities out there, yes, you often are forced to upgrade certain dependencies.
You can say "just maintain the older versions too", and that would be absolutely great, if anyone really did this. In practice anything but the most recent major is neglected.
You can say "I agree and that's why I never release 1.0", and I'd say that's a reasonable approach, but that just changes the problem to "too many packages are pre-1.0" and we'd have the same issue.
You can say "that degree of compatibility is too difficult to expect out of open source maintainers", and my response is that there ought to be fewer open source maintainers. (For real. I'd rather have 1/100th the number of crates in Cargo, if the ones that were there were all maintained by people who were serious about backwards compatibility.)
You say "the API sucked and I hoped I could make it better", but the API is the library to anyone using it, and changing it means you're literally changing what the library is, which means all existing code using the library has to change to meet your new opinion on what the better API is (an opinion many wouldn't share, including and especially the original authors.) Why not just start a new project instead?
The implication is that you should maintain the old version, if you're still using it. (And if no one is using it, who cares?)
> Improvements that need breaking changes should happen under a new name, with a new project, so that the old project can still exist and receive updates.
And then no one really maintains old projects, either.
Fundamentally, the only difference between "libfoo-1,libfoo-2" and "libfoo,libbar" is that the latter causes more namespace pollution and makes it harder to figure out which successor projects are at least trying to maintain the overall design goals of the previous version. (Non-fundamentally, yes, the former scheme makes it a bit easier for malicious bureaucrats to pretend the old library is 'deprecated' and shitcan it, but they do that with the new-name scheme anyway (eg libav vs ffmpeg, systemd vs every non-defective init system, etc).)
The problem with SemVer is it encourages you to "move fast and break things", constantly bumping major versions as a standard practice, rather than thinking very deeply about what abstractions you make public in your library (often minimizing the surface area as much as possible) to avoid painting yourself into a corner, and being extremely deliberate about any time you need to break the API in order to make a change. Ideally forking things with the changes and releasing the new library "all at once" once enough accumulated changes have built up, rather than bumping the major once every time.
The real issue I'm complaining about is the cavalier attitude towards breaking changes that library maintainers tend to have, and how much I believe SemVer caused it. If this attitude was not prevalent I'd have no problems with SemVer.
I really appreciate when a project calmly acknowledges that it's not the right tool for every use case, and is not trying to be. That's professional engineering.
Especially in the AI-age, the crucial skill will be what NOT to implement.
Outside of this not using a timer library is going for a world of pain
In the very early Go days (<0.9) he responded to a comment of mine going into why Go was worth looking into, quite passionately and enthusiastically which set me off on learning it and where it could be applied and that changed the kinds of roles I went after.
Ever since it's a bright little nugget whenever I see his name pop up and have tried to follow his work ever since.
Time is such a pain, I write code for simulating orbits of asteroids/stuff in the solar system, and time and time conversions play a major roll in it. I often need accuracy at the mega-year to giga-year scales, but also sometimes micro-second relative.
I saw on this page that you at least mention TAI time, how are you handling time scales in general? Like would it be hard to add some other timescales like UT1?
Right now I have to do all of this manually and I have been using chrono as just a convenience wrapper so that my users can convert ISO time strings into my internal representation.
Edit: Oh no! I just found out chrono is being semi-deprecated, looks like I'm going to be switching...
Ah yeah hifitime, I tried it out but its internal representation doesn't work well for my long term simulations, the integer representation ends up increasing the numerical noise in my simulations when I do really sensitive long term ones.
> Unlike “Comparison with other Rust datetime crates,” this document is opinionated. > [...] > Jiff is pronounced like “gif” with a soft “g,” as in “gem.”
Burntsushi really did not hold back with this document being opinionated :-) (Though they are right, of course).
[0] https://docs.rs/jiff/latest/jiff/_documentation/design/index...
[1] https://docs.rs/jiff-tzdb/latest/jiff_tzdb/#data-generation
The C++ date-time library goes and loads the system copy of ICU (which is updated via windows update) and pulls the tz data from ICU's calendar api.
Hopefully Safari will soon have temporal implemented and we can leave that behind (it's in 27.3b so not out of the question).
> Chrono actually is comparatively nice
burntsushi has written pretty extensively about:
1. comparisons to existing datetime libraries (https://docs.rs/jiff/latest/jiff/_documentation/comparison/i...), chrono's original author also commented (https://github.com/BurntSushi/jiff/issues/63)
2. why they felt it was a good idea to write a new library (https://docs.rs/jiff/latest/jiff/_documentation/design/index...)
3. why they didn't wish to contribute to either chrono or time (https://docs.rs/jiff/latest/jiff/_documentation/design/index...)
And as randomblock linked, chrono is deprecating itself.
This is still very surprising given the context; if the top datetime library of any language is getting soft-replaced with something nicer, woe be to those in other languages!
I found switching to Jiff from Chrono quite easy.
The alternative is to keep a relatively small standard library, and a good package manager, to make it easier for people to iterate on API design in third party packages. Major version changes in a single library can have much less impact accross the ecosystem than standard library packages. Eventually you may get a de facto standard, and sometimes they are then later incorporated into the standard library.
This model isn't without its downsides; it can sometimes mean fragmentation when standardization would help, sometimes these de facto standard libraries can become important enough that they run into the same ecosystem fragmentation issues on major releases. But it allows for more flexibility.
The latter model is what the Rust project decided on for everything outside of the most fundamental time types. Dates and times and timezones are notoriously hard to model in code, and easy to create API designs that are full of footguns, so this is a place where that extra freedom to iterate was more important than standardizing on an API early on.
That iteration has led to a number of different libraries, including time, chrono, and now jiff, allowing for exploring the space of API design to really get it right rather than being stuck with what was available early on.
Temporal does improve some things (it has more strict zoning / less defaults, and improves serialization through RFC 9557), but some of the divergences are not necessarily improvements and rather divergences of opinion (e.g. java.time wilfully made non-ISO calendars second-class, Temporal makes them first class more like Joda, and it's one of the things Colebourne — the lead author of Joda and java.time — strongly disagrees with[1], but the Temporal authors have pretty compelling reasons for it[2]).
[1] https://blog.joda.org/2009/11/why-jsr-310-isn-joda-time_4941... https://github.com/tc39/proposal-temporal/issues/5 https://github.com/tc39/proposal-temporal/issues/1454
[2] https://tc39.es/proposal-temporal/docs/calendar-review#why-a...
Not at all. We just want to avoid having the standard library be "where code goes to die", as Python folks have put it.
We're working on adding more popular APIs from the ecosystem to the standard library. See https://github.com/rust-lang/std-replacement-data/ for a data set tracking what crates have been obsoleted by additions to the standard library; we hope to increase that over time.
> disparate documentation
I've never experienced this while using a Rust library. They all use rustdoc hosted on docs.rs (or locally with $ cargo doc). They all look identical and there's a single global search bar that searches all your dependencies.
> conflicting dependencies
Since you can install two different versions of the same library, this is only an issue if two of your dependencies both expose a transitive dependency with different versions in their external APIs. (E.g. libA returns a Foo 1.0 and libB expects an argument of Foo 2.0) Only library I've ever run into this with is raw-window-handle.
> supply chain risks
> enormous .cargo
These I agree with. Although honestly the supply chain risk is not as big with these foundational libraries as it would first appear, since they are almost all maintained by the same 5 rust compiler developers. Really the only difference is that they're not in the rust-lang github organization and not shipped precompiled with the standard library
Documentation certainly has nothing to do with it.
Other factors you mentioned are more convincing.
For a systems programming language, Rust is relatively easy to write applications in -- but I suspect standard library choices (and other choices) will be driven by the systems side for the foreseeable future.
> Jiff is pronounced like “gif”
This would have been a hilarious line if he left off the second part!
AI wrote it under my strict design parameters. We use it in production in a high volume event production company, PRs welcome!
> Yeah I had a really hard time making the jiff-diesel and jiff-sqlx crates. Part of the problem is the very poor datetime support in the underlying databases. The other part of the problem is that I'm not a user of either diesel or sqlx, so there are some unknown unknowns for me.
https://www.reddit.com/r/rust/comments/1xx7v4v/comment/19sp2...
So I’m sure they’d be glad for assistance.
Strings are also similarly gnarly topic that I find a lot of devs try to ignore.
Thank you for your work on this burntsushi!
Woah now, let's not get too controversial.
Graphics Interchange Format. Guh-raphics. GIF
Fun linguistics experience for native English speakers: hold an open palm in front of your mouth, fairly close, and say 'spit', then say 'pit'. Much more air hits your hand when saying 'pit' than when saying 'spit'. That's the aspiration.
> Jiff is pronounced like “gif” with a soft “g,” as in “gem.”
This is classic anti-trust monopoly leveraging. Lucky I'm on this side of the debate :)
A masterclass in viral outrage bait. Not a Rustacean, I clicked the link exclusively for this nugget and will probably tell my Rust-loving colleagues about it tomorrow.
For the record, I like the converse better:
> Jiff is pronounced with a hard “g”, as in “gif”.
What a cardinal sin! Instantly distrust this project.
(I'm kidding, Andrew. But this is clearly the wrong pronunciation! :P)
Giraffical Interchange Format.
I really, really, hate Monday
The first problem is the bigger problem. If you are writing an app that asks the user for a zoned time, the user will want something like Nov 16 7pm eastern time. But EST is of course highly ambiguous and so is EDT. (The database actually gives EST to Panama Time and leaves EDT undefined.) The correct solution is either EST5EDT or America/New_York. Neither is user friendly. The first string EST5EDT looks like gibberish to the average user. The second raises concerns in all other cities sharing the same timezone as New York. Why not have an entry for Philadelphia or Washington D.C.? Some even say it is inherently classist to pick the city with the biggest population, not the most important by some other metric. Is New York more deserving than our nation’s political capital? Why is Los Angeles more deserving than San Francisco, other than the fact that the maintainer of the database is physically in Los Angeles? This is an actual criticism in iOS calendar app on the now defunct Apple forums. If you want the user to pick a timezone you better make sure Eastern Time is an allowed option, and maybe also include all the cities and municipalities in the zone; that’s what the newest iOS does. But in any case almost every developer now hard codes a mapping from Eastern Time to America/New_York if their audience is U.S. This feels like duplicative work better done in a library. The fact that a new library reaches 1.0 and doesn’t plan to add this might mean a lack of ambition to tackle this problem.
The second problem is the fact that the timezone definitions change according to the actual rules in effect in history. This is sometimes not what you want. Indeed I notice that most if not all date libraries use the proleptic Gregorian calendar (our current calendar system extended backwards); no library that I know of automatically switches to Julian calendars before the cutoff. Why this inconsistency? I’d argue that when most humans express a zoned time they expect the current rules to be extended backwards. People forget the daylight saving rules change in the 2000s when talking about times before that change and expect the current rules.
Not to be a detractor here for this library given the hard work of burntsushi, but we should aim higher.
> The second problem is the fact that the timezone definitions change according to the actual rules in effect in history. This is sometimes not what you want. Indeed I notice that sometimes all date libraries use the proleptic Gregorian calendar meaning our current calendar system extended backwards; no library that I know of automatically switches to Julian calendars before the cutoff. Why this inconsistency? I’d argue that when most humans express a zoned time they expect the current rules to be extended backwards. People forget the daylight saving rules change in the 2000s when talking about times before that change and expect the current rules.
Good question. One part of this answer is that the IANA tzdb does not only contain daylight saving time transitions. It also includes transitions from one offset to another, perhaps because daylight saving time was stopped or started. The other part of this answer is, I would guess, more pragmatic. Namely, we have structured data delineating time zone transitions back at least a century. If you go far enough back, then indeed, time zone transitions stop happening. We, however, do not, as far as I'm aware, have shared structured data delineating changes in calendar. This would also need to be organized by both location and time. For example, the Julian calendar was not dropped in favor of the Gregorian instantaneously everywhere. Some countries, like Russia, continued using the Julian calendar into the 20th century.
An other fun one is that some of the transition schemes were... imaginative, let's say. Famously Sweden didn't want a hard break so in 1699 they decided that they would just skip leap days until they were on Gregorian. So they skipped the one in 1700, then promptly forgot the 1704 and 1708 ones because they were busy with the Great Northern War, as a result the scheme was cancelled by reverting to the Julian calendar, which they did by adding a second leap day in 1712 (which thus had a February 30th, and 367 days). Sweden ended up doing the switch at once in 1753.
That's calendaring rather than timezoning tho. Timezones really only became a factor once timekeeping was precise enough and times had to be communicated and synchronised across vast distances, which really came about with the railways (first formal "time zone" was the Railway Time of England's Great Western Railway). Before that, cities and villages oft had their individual time based on apparent solar time at the location (aka a sundial). For instance Paris Mean Time was 9 minutes and 21 seconds ahead of London.
While not necessarily wrong, it should probably be a separate library entirely: there are projects maintaining GIS boundaries for the IANA timezones.
I found the icu::TimeZoneNames class. The docstring even describes my exact problem:
> For example, people in the United States refer the zone used by the east part of North America as "Eastern Time". The tz database contains multiple time zones "America/New_York", "America/Detroit", "America/Montreal" and some others that belong to "Eastern Time". However, assigning different display names to these time zones does not make much sense for most of people.
I then looked at the icu::TimeZoneNames::find member function and it seemed to do exactly what I proposed. https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/clas... Except it’s marked as internal use only. I don’t know what’s going on.
Do you seasoned rustaceans may explain why we don’t have such a standard library?
It’s a genuine question from an ignorant :)
Just look at the original java time stuff Vs those that came in java 8.
And once something is in the standard library it can never change.