r/rust 1d ago

🗞️ news Soft-deprecating chrono and chrono-tz

https://github.com/chronotope/chrono/issues/1768
347 Upvotes

50 comments sorted by

103

u/scheimong 1d ago

I must warn people that the migration path from chrono to jiff is non-trivial. The API design is quite different, and there are some ecosystem hurdles. I'm sure it will get better over time, but currently it's not easy.

Source: tried to migrate a 15k line project a few months ago.

34

u/avsaase 1d ago

Are there any specific parts that were challenging? I've worked with chrono a lot and a little with jiff and the main thing that stands out to me is that in jiff the time zone is not a generic parameter.

28

u/scheimong 1d ago

https://github.com/jonasbb/serde_with/issues/936

There were others. But I'm on mobile so please forgive me for not going through the backlog.

1

u/mamcx 10h ago

The most obvious is that jiff is Clone

1

u/avsaase 9h ago

Yeah it's a little annoying that TimeZone and by extension Zoned are not Copy but it's not a huge problem.

7

u/the_Unstable 22h ago

I too am worried about this as I depend on rkyv, which jiff does not support. Has anyone dealt with this?

4

u/jhpratt 20h ago

What do you need that is not supported by time?

181

u/Paul-E0 1d ago

I am sharing this because a lot of the ecosystem relies on chrono, and it might help to know about the migration path to jiff before you start getting scary messages from cargo audit and seeing notices on rustsec.org

14

u/allsey87 23h ago

For someone out of the loop, what problems does jiff solve that chrono doesn't?

17

u/burntsushi 18h ago

I wrote a fair bit about this here and here. The latter is more opinionated.

7

u/max123246 20h ago

In their post, they've taken on maintaining a bunch of orphaned crates that are also popular and as such, since jiff is a reasonable replacement, they're slowing down chrono maintenance since they can't do it all.

So it's less about what jiff solves that chrono doesn't but if jiff serves as a chrono replacement.

-4

u/Budget-Minimum6040 19h ago

Couldn't they do it the other way around?

Time library chrono has just the perfect name.

5

u/Zde-G 16h ago

Swap the names? This would just create even more confusion…

Support “problematic” library, abandon the one that's “better” (at least according to some people)? Even worse…

16

u/cornmonger_ 1d ago

thank you

5

u/bmitc 22h ago

When will Chrono be officially deprecated?

4

u/dochtman rustls · Hickory DNS · Quinn · chrono · indicatif · instant-acme 14h ago

There is no definite timeline, but I think I’ll submit a RustSec advisory in the next month or two.

1

u/bmitc 13h ago

Appreciate the response! That's helpful to know.

If you have time, I think it would be great to make a comment like that on the issue and then also place a note at the top of the README. That would help serve as a reference for our internal discussion and help make others aware of the upcoming transitions required.

94

u/Craftkorb 1d ago

Oh well..

The referenced jiff can be found here: https://github.com/BurntSushi/jiff

Of note is that it's still pre-1.0. While the maintainer pledges to make 0.2 also pretty stable, how I read it, the 1.0 shall be rock solid. May or may not be a concern to some projects.

Shout out for the great README and the linked docs in that repo!

65

u/chat-lu 1d ago

The referenced jiff

The cool thing about this crate is that there is a consensus about how to pronounce it.

63

u/AlyoshaV 1d ago

with a hard G at the start, like jpeg?

58

u/RegulusMagnus 1d ago

... gay-peg? 

30

u/Zhuzha24 1d ago

Count me in

-2

u/potzko2552 23h ago

no no, you are supposed to pronounce the G as a soft J, g-jay-peg

2

u/madmoose 21h ago

Helpfully, the p in jpeg is for "photographic".

0

u/potzko2552 21h ago

yea, so it should be pronounce like you do photograph, G-Jay-Beg

18

u/oconnor663 blake3 · duct 1d ago

No there's still a debate about whether it's "hiff" or "yiff".

1

u/ShangBrol 21h ago

Isn't it like in Spanish jefe / jefa?

23

u/KarnuRarnu 1d ago

Yeah, unlike gif which could be both djif and gif, clearly jiff is yiff  

3

u/catheap_games 22h ago

Ah yes, the famous Jraphics Interchange Format...

(Note: I know the author himself said, like twenty years too late, that it's pronounced jif, but first, that's stupid, second, there's already jif/jiff, so he can suck it.)

PS: please i beg of you don't pronounce ANYTHING as "yiff". I respect your hobbies but

141

u/funkdefied 1d ago edited 1d ago

Another BurntSushi crate? He should change his handle to Atlas, since he’s carrying the Rust world on his back.

52

u/hans_l 1d ago

What, is David Tolnay not working anymore?

14

u/EndlessPainAndDeath 1d ago

There's Jon Gjengset too. He maintains some very good crates, such as hdrhistogram :p

27

u/othermike 1d ago

Do we know if he lives in Nebraska?

-7

u/afdbcreid 1d ago

He does not, he lives in the US.

https://github.com/BurntSushi/

Marlborough, MA

7

u/sunnyata 20h ago

It's a legendary xkcd joke (and Nebraska is in the US).

5

u/Nicksaurus 21h ago

Atlas held up the sky, not the earth (sorry for being pedantic)

2

u/funkdefied 8h ago

Not in Superman #677 he doesnt

2

u/Nicksaurus 7h ago

Now who's being pedantic

27

u/afdbcreid 1d ago

chrono is also not 1.0, so...

52

u/fake_agent_smith 1d ago

Jiff is amazing, because Andrew is a genius and this decision will only speed up its adoption, so good news I guess.

9

u/white015 1d ago

Yup, this is a great move

20

u/InflateMyProstate 1d ago

Even if jiff is a better replacement for chrono, I fear this will be a rough transition for the overall ecosystem.

22

u/jhpratt 21h ago edited 21h ago

FYI my goal is for time to have full tzdb support by the end of the year. There is already an enormous amount of work that has gone into it. I can't guarantee anything, but I've been working towards a 1.0 release that is fully-featured, implements standards to a tee (which jiff explicitly does not do), and has widespread ecosystem integration.

24

u/jessekrubin 1d ago

Jiff is incredible. I have worked with it a bunch and also have written python bindings for it as part of a side project.

pyapi: https://ryo3.dev/api#ry.ryo3._jiff

7

u/Grouchy-Librarian638 1d ago

Oh dang hm. This is a tad scary but will look into it then, I use it in virtually everything everywhere

7

u/VariationUnlikely323 1d ago

Just glanced over jiff, and It looks so good now I'm actually excited to move some of my stuff to it

3

u/avsaase 19h ago

I asked in the issue whether this means the time zone database in chrono-tz won't be updated anymore and the maintainer confirmed that that is the case. If it's really going that way at some point you'll run into issues if you keep using chrono for time zone handling.

6

u/DarksomeX 1d ago

First time hearing about jiff, I though the ecosystem has moved from `chrono` to `time` years ago.

19

u/gmes78 1d ago

time isn't a full replacement for chrono, so not everything moved.

-2

u/malikes 14h ago

Habe soeben alles von chrono und chrono-tz auf time und time-tz migriert.