Unix Timestamps and How Computers Track Time
What January 1, 1970 means, why counting seconds beats calendars, the Y2K38 problem, and how time zones complicate everything.
Every device on the internet has an address. Not a street address — a 32-bit number split into four chunks, written like 192.168.1.42. That familiar dotted-decimal notation hides a world of binary math underneath. Understanding how IP addresses actually work means understanding subnetting — the art of dividing a network into smaller, manageable pieces using nothing but bitwise arithmetic.
An IPv4 address like 192.168.1.42 is really a single 32-bit binary number. Each of the four “octets” (the numbers between the dots) represents 8 bits, ranging from 0 to 255. The human-friendly dotted format is purely for readability.
192.168.1.42 in binary:
192 . 168 . 1 . 42
11000000 . 10101000 . 00000001 . 00101010
Full 32-bit representation:
11000000101010000000000100101010Every calculation in subnetting — determining network boundaries, counting hosts, checking if two devices are on the same network — happens at this binary level. The decimal notation is just a convenience layer on top.
Each octet can hold values from 00000000 (0) to 11111111 (255). That's 2^8 = 256 possible values per octet. The entire IPv4 address space is 2^32 = roughly 4.3 billion unique addresses. That sounds like a lot, but it ran out years ago — which is why we have NAT, private address ranges, and IPv6.
A subnet mask splits an IP address into two parts: the network portion (which network is this device on?) and the host portion (which specific device within that network?). The mask is another 32-bit number where all the 1-bits mark the network part and all the 0-bits mark the host part.
IP address: 192.168.1.42 → 11000000.10101000.00000001.00101010
Subnet mask: 255.255.255.0 → 11111111.11111111.11111111.00000000
^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^
Network bits (24) Host bits (8)The key operation is a bitwise AND. When you AND the IP address with the subnet mask, you get the network address — the identifier for the entire subnet. Every device on the same subnet shares this network address.
11000000.10101000.00000001.00101010 (192.168.1.42)
AND 11111111.11111111.11111111.00000000 (255.255.255.0)
= 11000000.10101000.00000001.00000000 (192.168.1.0) ← network addressTwo devices are on the same subnet if and only if their IP addresses, when ANDed with the same mask, produce the same network address. A router uses this exact check to decide whether to forward a packet locally or send it to another network.
Writing 255.255.255.0 every time is tedious. CIDR (Classless Inter-Domain Routing) notation replaces the mask with a single number: the count of leading 1-bits. A mask of 255.255.255.0 has 24 leading ones, so we write it as /24.
| CIDR | Subnet Mask | Usable Hosts | Common Use |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 | Giant corporate networks |
| /16 | 255.255.0.0 | 65,534 | Large campus networks |
| /24 | 255.255.255.0 | 254 | Home networks, small offices |
| /30 | 255.255.255.252 | 2 | Point-to-point router links |
| /32 | 255.255.255.255 | 1 | Single host route |
The formula for usable hosts is 2^(32 - prefix) - 2. You subtract 2 because every subnet reserves two addresses: the network address (all host bits = 0) and the broadcast address (all host bits = 1).
In the early internet, networks were divided into rigid classes: Class A (/8), Class B (/16), and Class C (/24). A company that needed 300 addresses got a Class B with 65,534 — wasting over 99% of the space. Subnetting solves three problems at once:
Given 10.20.30.100/26, find the network address, broadcast address, and usable host range:
Given: 10.20.30.100/26
Step 1 — Host bits: 32 - 26 = 6
Step 2 — Block size: 2^6 = 64
Step 3 — Boundaries in last octet: 0, 64, 128, 192
100 falls in the 64–127 block
Network address: 10.20.30.64
First usable host: 10.20.30.65
Last usable host: 10.20.30.126
Broadcast address: 10.20.30.127
Usable hosts: 62Subnetting is binary arithmetic with a practical purpose. Every network engineer, cloud architect, and DevOps engineer who configures VPCs, security groups, or firewall rules is doing subnetting — whether they realize it or not.
What January 1, 1970 means, why counting seconds beats calendars, the Y2K38 problem, and how time zones complicate everything.
What UUIDs are, v4 vs v7, collision probability, hashing fundamentals, broken vs secure algorithms, and how JWTs carry authentication.
Core SQL operations, JOINs explained simply, GROUP BY and aggregates, why formatting matters, SQL dialects, and when to choose NoSQL.