<rss version="2.0">
  <channel>
    <title>Unix on LLBBL Blog</title>
    <link>https://llbbl.blog/categories/unix/</link>
    <description></description>
    
    <language>en</language>
    
    <lastBuildDate>Fri, 05 Jun 2026 10:00:00 -0500</lastBuildDate>
    
    <item>
      <title>Day 13: Unix Time, 1,780,620,532</title>
      <link>https://llbbl.blog/2026/06/05/day-unix-time.html</link>
      <pubDate>Fri, 05 Jun 2026 10:00:00 -0500</pubDate>
      
      <guid>http://llbbl.micro.blog/2026/06/05/day-unix-time.html</guid>
      <description>&lt;p&gt;That&amp;rsquo;s roughly what time it is, right now, as I type this.&lt;/p&gt;
&lt;p&gt;Not 8:48 PM. Not &amp;ldquo;Thursday.&amp;rdquo; Not &amp;ldquo;June 4th, 2026.&amp;rdquo; None of those are what your computer thinks &amp;ldquo;now&amp;rdquo; is. To your laptop, your phone, your car&amp;rsquo;s infotainment system, the streaming server pushing this page to your browser, and the ATM in the corner store, &lt;em&gt;now&lt;/em&gt; is a number. A 10-digit integer. Counting up, one tick per second, since a fixed moment in 1970.&lt;/p&gt;
&lt;p&gt;That number runs the world. It&amp;rsquo;s the closest thing the global computing infrastructure has to a heartbeat. And it has some weird properties, almost none of which are explained by the name it goes by.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Unix time.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&#34;the-clock-under-every-clock&#34;&gt;The clock under every clock&lt;/h2&gt;
&lt;p&gt;Open a terminal. Type &lt;code&gt;date +%s&lt;/code&gt;. You&amp;rsquo;ll see something like &lt;code&gt;1780620532&lt;/code&gt; come back. That&amp;rsquo;s Unix time. Seconds since the &lt;strong&gt;Unix epoch&lt;/strong&gt;, &lt;code&gt;1970-01-01T00:00:00 UTC&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Every modern operating system tracks time this way internally, even if it dresses up the output for you. The pretty &amp;ldquo;8:48 PM&amp;rdquo; on your menu bar is a calculation: take the current Unix timestamp, apply your timezone offset, run it through the calendar rules, format it for display. The underlying number is just &lt;code&gt;1,780,620,532&lt;/code&gt;-and-change, counting up.&lt;/p&gt;
&lt;p&gt;JavaScript&amp;rsquo;s &lt;code&gt;Date.now()&lt;/code&gt;? Unix time in milliseconds. Java&amp;rsquo;s &lt;code&gt;System.currentTimeMillis()&lt;/code&gt;? Unix time in milliseconds. Python&amp;rsquo;s &lt;code&gt;time.time()&lt;/code&gt;? Unix time as a float. Go&amp;rsquo;s &lt;code&gt;time.Now().Unix()&lt;/code&gt;? Unix time. PostgreSQL&amp;rsquo;s &lt;code&gt;EXTRACT(epoch FROM ...)&lt;/code&gt;? Unix time. SQLite&amp;rsquo;s &lt;code&gt;strftime(&#39;%s&#39;, &#39;now&#39;)&lt;/code&gt;? Unix time.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s the lingua franca of computing. Two systems written in different languages, on different continents, with different calendars in their UIs, agree about what &lt;em&gt;now&lt;/em&gt; means because they both agree about this one number.&lt;/p&gt;
&lt;h2 id=&#34;why-1970&#34;&gt;Why 1970?&lt;/h2&gt;
&lt;p&gt;The honest answer is: convenience.&lt;/p&gt;
&lt;p&gt;In the early 1970s, Ken Thompson and Dennis Ritchie were building Unix at Bell Labs. They needed a way to represent time on a 32-bit machine. Their first attempt counted &lt;strong&gt;1/60 of a second per tick&lt;/strong&gt; in a 32-bit integer, and overflowed in about two and a half years. So they switched to &lt;strong&gt;1 tick per second&lt;/strong&gt;, which gave them roughly 136 years of range in a signed 32-bit integer.&lt;/p&gt;
&lt;p&gt;Then they needed a zero. They picked &lt;code&gt;1970-01-01&lt;/code&gt; because:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;It was recent enough that the historical calendar mess (Julian vs. Gregorian, the dropped days in 1582, the year that started in March) was someone else&amp;rsquo;s problem.&lt;/li&gt;
&lt;li&gt;It was round.&lt;/li&gt;
&lt;li&gt;It predated every Unix system anyone cared to represent.&lt;/li&gt;
&lt;li&gt;It was conveniently close to UTC&amp;rsquo;s formalization a couple of years later.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That&amp;rsquo;s it. There&amp;rsquo;s no cosmological significance to 1970-01-01. It&amp;rsquo;s not aligned with any astronomical event. It&amp;rsquo;s the timestamp equivalent of &lt;code&gt;git init&lt;/code&gt;. &lt;em&gt;We&amp;rsquo;ll start counting from here, and we&amp;rsquo;ll figure the rest out later.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The &amp;ldquo;later&amp;rdquo; turned out to mean &lt;strong&gt;everywhere&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;the-thing-that-isnt-there-leap-seconds&#34;&gt;The thing that isn&amp;rsquo;t there: leap seconds&lt;/h2&gt;
&lt;p&gt;The computer&amp;rsquo;s time problem mostly comes from UTC.&lt;/p&gt;
&lt;p&gt;Unix time is defined as the number of seconds since the Unix epoch. You might reasonably assume that if I have two timestamps, the difference between them is the actual number of physical seconds that elapsed between those two moments.&lt;/p&gt;
&lt;p&gt;It is not.&lt;/p&gt;
&lt;p&gt;Unix time &lt;strong&gt;does not count leap seconds&lt;/strong&gt;. Since 1972, the IERS has inserted &lt;strong&gt;27 leap seconds&lt;/strong&gt; into UTC, extra seconds added to keep civil time aligned with Earth&amp;rsquo;s slowing rotation. Unix time pretends they never happened. The Unix clock has, over its 56-year lifetime, &amp;ldquo;lost&amp;rdquo; almost half a minute relative to reality.&lt;/p&gt;
&lt;p&gt;Even weirder: during the actual leap second, when UTC ticks &lt;code&gt;23:59:59 → 23:59:60 → 00:00:00&lt;/code&gt;, Unix time has to do &lt;em&gt;something&lt;/em&gt;. POSIX doesn&amp;rsquo;t specify what. So implementations have invented three different answers:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Repeat the second.&lt;/strong&gt; The clock shows &lt;code&gt;23:59:59&lt;/code&gt; for two real seconds and then jumps to &lt;code&gt;00:00:00&lt;/code&gt;. Two distinct physical moments share the same timestamp. File mtimes can collide, log entries can appear out of order.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Insert the second.&lt;/strong&gt; The clock briefly shows &lt;code&gt;23:59:60&lt;/code&gt;, which is a valid UTC string but breaks every parser that assumes seconds run 00–59. Linux kernels do this. Hilarity ensues at midnight.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Smear it.&lt;/strong&gt; Don&amp;rsquo;t insert the second at all. Slow every clock down by a tiny fraction over a 24-hour window so it absorbs the missing second smoothly. Google does this. Amazon does it. Facebook does it.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;So &amp;ldquo;Unix time&amp;rdquo; in 2026 means three subtly different things depending on whether your server is running stock Linux, smeared Google time, or one of the dozens of variants in between. Two timestamps from two providers may disagree by a second, and &lt;em&gt;both are correct under their own definitions&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s what the spec authors call &amp;ldquo;implementation-defined behavior&amp;rdquo; and what the rest of us call &amp;ldquo;why distributed-system logs don&amp;rsquo;t line up.&amp;rdquo;&lt;/p&gt;
&lt;h2 id=&#34;the-number-is-also-a-string&#34;&gt;The number is also a string&lt;/h2&gt;
&lt;p&gt;Integers are easy for computers but humans expect a string. Unix time is the easiest timestamp format to compare, sort, and store because it&amp;rsquo;s an integer, but as soon as we convert to human-readable format, all that changes.&lt;/p&gt;
&lt;p&gt;To find out which one is earlier, subtract. To sort a million events, sort the integers. To store one efficiently, write 8 bytes. To send one over the network, send 8 bytes.&lt;/p&gt;
&lt;p&gt;Compare this to a full ISO 8601 timestamp like &lt;code&gt;2026-06-04T16:47:23.512847+00:00&lt;/code&gt;. That&amp;rsquo;s a 32-character string that needs to be parsed, validated, normalized for timezone, and converted to a comparable representation before you can do anything with it. Every comparison is a parsing pass. Every storage is 4× the bytes. Every sort is a string sort with calendar rules.&lt;/p&gt;
&lt;p&gt;Unix time is &lt;em&gt;fast&lt;/em&gt;. It&amp;rsquo;s so fast that even formats designed to replace it (Google&amp;rsquo;s Spanner, AWS&amp;rsquo;s KSUIDs, Twitter&amp;rsquo;s Snowflake) embed Unix-like millisecond counts at their core and just append entropy bytes around them.&lt;/p&gt;
&lt;p&gt;The ubiquity isn&amp;rsquo;t an accident. It&amp;rsquo;s the natural result of picking the representation that&amp;rsquo;s cheapest at every step.&lt;/p&gt;
&lt;h2 id=&#34;the-untimes&#34;&gt;The Untimes&lt;/h2&gt;
&lt;p&gt;Unix time is a &lt;strong&gt;convention&lt;/strong&gt; that has eaten the world.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s anchored to UTC, which means it inherits UTC&amp;rsquo;s quirks. It&amp;rsquo;s embedded controllers in cars, industrial equipment, network gear, satellite firmware, gas pumps, so pretty much every piece of modern infrastructure.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;1,780,620,532&lt;/code&gt; is just a number, a timestamp. It&amp;rsquo;s used by your bank for transactions, used by your file system for its files, but also it&amp;rsquo;s a hack. A 56-year-old dart in the board of of time, that ignores leap seconds, depends on UTC, has three different definitions during the same physical second, and we built the entire internet on top of it.&lt;/p&gt;
&lt;p&gt;Tomorrow will be on what happens when the bill comes due. &lt;strong&gt;Y2K and Y2038&lt;/strong&gt;, the bug that didn&amp;rsquo;t end the world, and the bug that still might.&lt;/p&gt;
&lt;h2 id=&#34;sources&#34;&gt;Sources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Unix_time&#34;&gt;Unix time — Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Leap_second&#34;&gt;Leap second — Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Coordinated_Universal_Time&#34;&gt;Coordinated Universal Time — Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/International_Earth_Rotation_and_Reference_Systems_Service&#34;&gt;International Earth Rotation and Reference Systems Service — Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://developers.google.com/time/smear&#34;&gt;Leap Smear — Google Developers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://aws.amazon.com/blogs/aws/look-before-you-leap-the-coming-leap-second-and-aws/&#34;&gt;Look Before You Leap — The Coming Leap Second and AWS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://engineering.fb.com/2022/07/25/production-engineering/its-time-to-leave-the-leap-second-in-the-past/&#34;&gt;It&amp;rsquo;s time to leave the leap second in the past — Engineering at Meta&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://engineering.fb.com/2025/02/03/production-engineering/how-precision-time-protocol-ptp-handles-leap-seconds/&#34;&gt;How Precision Time Protocol handles leap seconds — Engineering at Meta&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.theregister.com/2012/07/02/leap_second_crashes_airlines/&#34;&gt;Leap second bug cripples Linux servers at airlines, Reddit, LinkedIn — The Register&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://access.redhat.com/articles/15145&#34;&gt;Resolve Leap Second Issues in Red Hat Enterprise Linux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/History_of_Unix&#34;&gt;History of Unix — Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Snowflake_ID&#34;&gt;Snowflake ID — Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/segmentio/ksuid&#34;&gt;ksuid — segmentio (GitHub)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I&amp;rsquo;d appreciate a follow. You can subscribe with your email below. The emails go out once a week, or you can find me on Mastodon at &lt;a href=&#34;https://micro.blog/llbbl?remote_follow=1&#34;&gt;@logan@llbbl.blog&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>