A little oddity in the way curl deals with old dates
https://shkspr.mobi/blog/2025/09/a-little-oddity-in-the-way-curl-deals-with-old-dates/
For boring technical reasons, computers think the world began on 1st of January 19700. To keep track of the future, they count the number of seconds since that momentous date. So zero seconds represents midnight on that day1.
So how do computers deal with dates before The Beatles' Abbey Road was top of the UK album2 charts?
Negative numbers! Most modern computers can deal with dates far in the past and, hopefully, far into the future. Again, for boring technical reasons, lots of computers can only save files with a date no earlier than 13th December 19013.
When you download a file from the Internet, the sending server can tell you when that file was last modified. That's useful if you only want to download the file if it has changed since you last got it.
It presents the date using RFC 1123 format for reasons which are lost to the ages.
< Last-Modified: Wed, 09 Oct 1940 16:45:49 +0100
Great!
If you use the venerable wget utility, it will happily save the file on your disk and tell you that is when it was created.
But what if you use curl -OR to download the file? The -R option says:
THIS IS A LIE!4
If curl sees a date with a negative time, it pretends that the past doesn't exist and that what you really wanted was to save the file with today's date and time.
Why does it do this?
I think it is because this code only checks for times ≥ 0. Which, I guess, is pretty reasonable. There weren't many computers around before the 1970s5 so the chances of finding a file which predates disco are slim.
Should we storm the barricades and demand this temporal anomaly be rectified?6 Nah. I've raised it as a discussion item on curl's GitHub.
If you have strong opinions about this - please join in the discussion7.
Although, who is to say it didn't? Were you there? Do you have proof? Maybe the Young Earth Creationists aren't ambitious enough?! ↩︎
Except! Psych! It doesn't! The UK was experimenting with year-round BST so there's actually an hour's difference. Time is hard™. ↩︎
Do not search for the number 1 single on that date. You'll give yourself a sad. ↩︎
The music charts were less well-developed in 1901. But you could have read "The Purple Cloud" which is a brilliant early sci-fi novel. ↩︎
Everything you know is false! How deep does this conspiracy go!?!? ↩︎
Although, there were some. Not just the secret ones used to control the weather - but actual proper computers you could use to do maths! ↩︎
Preferably by firing photon torpedoes. Or maybe ejecting the warp core. I'm not an engineer. ↩︎
Or seek help from a mental health professional. ↩︎