惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Security Affairs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
大猫的无限游戏
大猫的无限游戏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
阮一峰的网络日志
阮一峰的网络日志
GbyAI
GbyAI
D
Docker
美团技术团队
N
Netflix TechBlog - Medium
罗磊的独立博客
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Hugging Face - Blog
Hugging Face - Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Jina AI
Jina AI
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
M
MIT News - Artificial intelligence
腾讯CDC
MongoDB | Blog
MongoDB | Blog
Last Week in AI
Last Week in AI
博客园 - 三生石上(FineUI控件)
博客园 - 叶小钗
V
V2EX
L
LangChain Blog
博客园 - 【当耐特】
B
Blog RSS Feed
量子位
U
Unit 42
Engineering at Meta
Engineering at Meta
小众软件
小众软件
宝玉的分享
宝玉的分享
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
云风的 BLOG
云风的 BLOG
博客园 - 聂微东
博客园 - 司徒正美
The Cloudflare Blog
The GitHub Blog
The GitHub Blog
T
Tailwind CSS Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
The Last Watchdog
The Last Watchdog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
SegmentFault 最新的问题
博客园_首页
Attack and Defense Labs
Attack and Defense Labs
TaoSecurity Blog
TaoSecurity Blog
Apple Machine Learning Research
Apple Machine Learning Research
S
Security @ Cisco Blogs

Hacker News

Introducing Claude Opus 4.7 Qwen Studio The Future of Everything is Lies, I Guess: Where Do We Go From Here? GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis Bonsai 1-bit WebGPU - a Hugging Face Space by webml-community Moving a large-scale metrics pipeline from StatsD to OpenTelemetry / Prometheus GitHub - Nightmare-Eclipse/RedSun: The Red Sun vulnerability repository GitHub - SethPyle376/hiraeth: Local AWS emulator focused on fast integration testing, with SQS support, SQLite-backed state, and a debug-friendly web UI. GitHub - macOS26/Agent: Any AI, replaces Claude Code, Cursor, OpenClaw. Over 18 LLM providers (Claude, OpenAI, Gemini, Ollama, Zai, HF, Qwen) wired into a native Mac app that writes code, builds Xcode projects, bumps versions, manages git, automates Safari, use AppleScript, JS or Accessibility, extend Agent! w/ MCP Servers, run tasks from your iPhone via Messages. YouTube now lets you turn off Shorts I Made a Terminal Pager Burgers | マクドナルド公式 Commands — HackerNews CLI documentation ChatGPT for Excel PiCore - Raspberry Pi Port of Tiny Core Linux Live Nation illegally monopolized ticketing market, jury finds Google Broke Its Promise to Me. Now ICE Has My Data. Founding Engineer at Adaptional | Y Combinator CRISPR takes important step toward silencing Down syndrome’s extra chromosome GitHub - saffron-health/libretto: The AI toolkit for building reliable browser automations US v. Heppner (S.D.N.Y. 2026) no attorney-client privilege for AI chats [pdf] Retrofitting JIT Compilers into C Interpreters IPv6 – Google The Accursèd Alphabetical Clock Cybersecurity Looks Like Proof of Work Now Fragments: April 14 Cal.com Goes Closed Source: Why AI Security Is Forcing Our Decision | Cal.com - Scheduling Software for Online Bookings Laravel raised money and now injects ads directly into your agent When moving fast, talking is the first thing to break Too much Discussion of the XOR swap trick – Heather Cafe Introduction to Spherical Harmonics for Graphics Programmers The Grand Line Building a Z-Machine in the worst possible language High-Level Rust: Getting 80% of the Benefits with 20% of the Pain GitHub - duguyue100/midnight-captain: Inspired by Midnight Commander, tailored to my taste. How to build a `git diff` driver · Jamie Tanna | Software Engineer Center for Responsible, Decentralized Intelligence at Berkeley The Local Universe’s Expansion Rate Is Clearer Than Ever, but Still Doesn’t Add Up - A new synthesis of astronomical measurements confirms a persistent mismatch that could point to physics beyond current models The air throughout our homes is infused with microplastics. But there are things you can do to breathe less of them The disturbing white paper Red Hat is trying to erase from the internet – OSnews The Future of Everything is Lies, I Guess: Annoyances ‘Abhorrent’: the inside story of the Polymarket gamblers betting millions on war Productive procrastination — Max van IJsselmuiden maps, territory and LMs 447 Terabytes per Square Centimetre at Zero Retention Energy: Non-Volatile Memory at the Atomic Scale on Fluorographane Show HN: Pardonned.com – A searchable database of US Pardons 20 Years on AWS and Never Not My Job The Seasons are Wrong Artemis II crew splashes down near San Diego after historic moon mission We gave an AI a 3 year retail lease in SF and asked it to make a profit | Andon Labs How a dancer with ALS used brainwaves to perform live On filing the corners off my MacBooks Installing every* Firefox extension OpenClaw’s memory is unreliable, and you don’t know when it will break Steve Blank Nowhere Is Safe Chimpanzees in Uganda locked in vicious 'civil war', say researchers watgo - a WebAssembly Toolkit for Go linux/Documentation/process/coding-assistants.rst at master · torvalds/linux GitHub - callumlocke/json-formatter: Makes JSON easy to read. Founding Product Engineer at Bild AI | Y Combinator A compelling title that is cryptic enough to get you to take action on it GitHub - Keychron/Keychron-Keyboards-Hardware-Design: Industrial design files for Keychron keyboards and mice. 100+ models with CAD assets in STEP, DXF, DWG, and PDF. Source-available, with commercial use allowed for original compatible accessories within the license terms. [ANNOUNCE] WireGuardNT v0.11 and WireGuard for Windows v0.6 Released 1D-Chess Helium Is Hard to Replace Cooperative Vectors Introduction | Evolve Keeping a Postgres queue healthy — PlanetScale Our response to the Axios developer tool compromise Do Americans read print books, e-books or audiobooks more? The Zettelkasten Method in Obsidian: A Practical Setup Guide Artemis II Is Competency Porn and We Are Starving For It WeakC4 Flight Viz — Cockpit View A Mexican surveillance giant you’ve never heard of is now watching the U.S. border Surelock: Deadlock-Free Mutexes for Rust RISC-V 101 – what is it and what does it mean for Canonical? | Ubuntu The Problem That Built an Industry How Much Linear Memory Access Is Enough? | Solidean Investigating Split Locks on x86-64 Simplest hash functions Sybilproof reputation mechanisms (2005) [pdf] What is a property? How Complex is my Code? Static code analysis in Kotlin — tools overview Toffoli gates are all you need PGLite evangelism dcmake: a new CMake debugger UI Clojure on Fennel part one: Persistent Data Structures Fragments: April 2 Python Release Python install manager 26.1 The Life and Death of the Book Review - Liberties Introducing Database Traffic Control — PlanetScale Bitcoin miners are losing $19,000 on every BTC produced as difficulty drops 7.8% God sleeps in the minerals Building slogbox Apple Silicon and Virtual Machines: Beating the 2 VM Limit Who was “Not Even Wrong” first? Pokemon Evolution Vs Darwinian Evolution The APL Programming Language Source Code
What is Date::ITALY?
2026-05-17 · via Hacker News

The other day I was perusing a Ruby backtrace and paused as something caught my eye: Date::ITALY. What could that be?

irb(main):001> Date::ITALY
=> 2299161

Allrighty, not exactly self-explanatory. Upon visiting the documentation for class Date, I was greeted by a few other unusual sounding constants, including ENGLAND, GREGORIAN, and JULIAN. What do the docs have to say about these?

ENGLAND
The Julian day number of the day of calendar reform for England and her colonies.

GREGORIAN
The Julian day number of the day of calendar reform for the proleptic Gregorian calendar.

ITALY
The Julian day number of the day of calendar reform for Italy and some catholic countries.

JULIAN
The Julian day number of the day of calendar reform for the proleptic Julian calendar.

First of all, I think it is humorous that the Ruby source code mentions England and her colonies as well as some catholic countries. Second, I learned the term proleptic, which refers to extrapolating calendar dates outside the time of their adoption or use. But OK, the question on everyone’s mind – what is a Julian day number? Well, not so fast, because first we have to cover the catholicism part.

The Gregorian Switchover

The Julian calendar, established by the eponymous Caesar, had been cooking along fairly accurately for quite some time. But, it wasn’t perfect, losing a day about every 128 years. By the time of Pope Gregory XIII in the 1580s, the date of Easter had unacceptably moved about two weeks towards the Summer. In 1582, the Papal bull Inter gravissimas declared that the day following Thursday, 4 October 1582 would be Friday, 15 October 1582. Indeed, Ruby conforms, raising an exception if you attempt to instantiate a date within that ten day period:

irb(main):001> Date.new(1582, 10, 5)
(irb):1:in 'Date#initialize': invalid date (Date::Error)

and helpfully hops right over them when iterating, like it never happened:

irb(main):001> Date.new(1582, 10, 4).next_day
=> #<Date: 1582-10-15 ((2299161j,0s,0n), +0s,2299161j)>

Wait a moment, where have we seen that number before? Yes, Date::ITALY encodes the Julian day on which Italy switched from the Julian calendar to the Gregorian calendar – Julian day 2,299,161. If you were ever wondering what those weird numbers were in Date#inspect, those are Julian Day numbers.

Julian Days

Like all good stories, this one starts over six thousand years ago. On a very special Monday, New Year’s day in 4713 BC, at exactly noon UTC, the three most important multi-year cycles of humankind were perfectly synchronized: the 28 year solar cycle, the 19 year lunar cycle, and of course the 15 year Roman tax collection cycle, commonly referred to as the indiction cycle. Indeed, the Julian day cycle is a period of 28 x 19 x 15 = 7980 years, which will roll over once again in the year 3268 AD.

Why do we need this? As we saw earlier, there are some ‘gaps’ in the accounting of days in human history. To add to the confusion, not all countries adopted the Gregorian calendar at the same time – England for example, waited until 1752, as the Protestants were hesitant to adopt Catholic innovation (hence, Date::ENGLAND). Therefore, a sort of ‘universal intermediary’ was required to compute back and forth unambiguously between various calendar systems. Thus a simple count of days from a somewhat arbitrary epoch was created. Literally 1 year after the introduction of the Gregorian calendar, scholar Joseph Scaliger proposed the Julian Period method. Unbelievably confusingly, this Period was not named for the Julian calendar, or Julius Caesar that it was named after – it was named after his father Julius Caesar Scaliger, who was himself named after Julius Caesar. This is not unlike the Caesar salad, famously named after Caesar Cardini (famously named after Julius Caesar (whose name is famously actually Gaius.))

Ok, back to Ruby. We now know that Date::ITALY and Date::ENGLAND define the Julian day number that Italy and England respectively adopted the Gregorian calendar. That leaves Date::GREGORIAN and Date::JULIAN. I bet you’ll never guess:

irb(main):001> Date::GREGORIAN
=> -Infinity
irb(main):002> Date::JULIAN
=> Infinity

Alrighty, not exactly self-explanatory. To make sense of this, we will have to understand the Date initializer:

new(year = -4712, month = 1, mday = 1, start = Date::ITALY)

Two things here: first, the default date is equivalent to Date.jd(0). If you have ever wondered why Date.new.to_s gives "-4712-01-01", now you know. Second, the optional start argument is the ‘start of the Gregorian calendar’, expressed in Julian Days.

If you were working on a SaaS product in England in the 1700s, you would express Sir Isaac Newton’s DOB as Date.new(1642, 12, 25, Date::ENGLAND) rather than Date.new(1643, 1, 4). This also means that Date.new(1582, 10, 5, Date::ENGLAND) does not raise an exception like it does for Date::ITALY. In English parlance, Isaac’s birthday expressed as 1642/12/25 would be called the ‘old style’, and 1643/1/4 the ‘new style’ date. This is why Ruby’s date_core.c often mentions os and ns.

If you always want to use the Julian calendar, you could kick the ‘Gregorian switchover’ can infinitely down the road. This is why Date::JULIAN is Float::INFINITY. Passing Date::GREGORIAN (-Float::INFINITY) implies that the switchover happened ‘infinitely long ago’, or in other words, ‘we have always been using the Gregorian calendar’.

Because these values are assumed to be Julian Days, you can also provide your own arbitrary values. For example, if you wanted to model dates in Russia, where the Gregorian calendar was adopted on 14 February, 1918, you would:

irb(main):001> Date.new(1918, 1, 31, 2421639).next_day
=> #<Date: 1918-02-14 ((2421639j,0s,0n),+0s,2421639j)>

God help us if we ever switch to a new calendar system, because a single start argument won’t cut it anymore!

Closing Thoughts

If you are wondering if Isaac Newton actually was born on Christmas or rather January 4th, well, that is exactly the issue that Gregory XIII was out to solve!

Because the Julian Period is a synchronization of three other cycles, it is referred to as a tricyclic system.

The indiction cycle may have been chosen as a third cycle because historical records often were linked not to a date but rather an indiction number.

Contrary to what I said above, it is contested as to whether the Julian Period was originally referring to the Julian calendar or rather named after Joseph’s father.

Conceptually, you can think of a Date as a (julian date, gregorian switchover) tuple, combined with methods that compute answers based on those two values. In the inspect format of a date, for example #<Date: 1582-10-15 ((2299161j,0s,0n), +0s,2299161j)>, you are seeing the date expressed as a Julian day number, plus the seconds and nanoseconds of a time component, then a time zone offset, and finally the provided Julian day of the Gregorian switchover. A DateTime will use the 0s, 0ns portion for the time component.

Left as an exercise for the reader, there are a few fun methods in class Date as well:

  • #gregorian_leap?
  • #julian_leap?
  • #jisx0301
  • #rfc2822
  • #rfc3339

Further Reading

  • https://docs.ruby-lang.org/en/master/language/calendars_rdoc.html#argument-start
  • https://github.com/ruby/ruby/blob/master/ext/date/date_core.c
  • https://quasar.as.utexas.edu/BillInfo/JulianDatesG.html
  • https://en.wikipedia.org/wiki/Julian_day