Why do some time zones have 30 or 45 minute offsets?
Because time zones are political decisions, not geographical ones — and a country free to choose its offset is free to choose one that does not align with an hour boundary.
The underlying geography. The Earth rotates 360 degrees in 24 hours, so 15 degrees of longitude corresponds to one hour of solar time. A tidy system would divide the world into 24 zones of 15 degrees each.
Why it is not tidy. Every country decides its own offset, and the decisions reflect:
Wanting a single time zone across a country wide enough to span several. India uses a single offset of UTC+5:30 — a compromise between its eastern and western extremes, which would otherwise require two zones. China spans five geographical zones and uses one, meaning sunrise in the far west occurs very late by the clock.
Aligning with a neighbour for trade and administration, or deliberately not aligning, for political reasons.
Historical accident, where an offset was set relative to a colonial power's time and retained.
Splitting the difference where a country sits between zones.
The 45-minute offsets are rarer still: Nepal at UTC+5:45, chosen partly to be distinct from India; parts of Australia at UTC+8:45; and the Chatham Islands at UTC+12:45.
The extremes. The range spans from UTC−12 to UTC+14 — more than 24 hours in total, because some Pacific territories chose offsets placing them a full day ahead of neighbours a short distance away. Kiribati moved the date line to bring its whole territory onto one date.
Why it matters practically:
Software must not assume hour offsets, and the assumption that time zones are whole hours is a classic and persistent source of bugs.
Offsets change, sometimes at short notice, when governments decide — which is why time zone databases are updated frequently and why storing an offset rather than a zone name causes problems later.
Daylight saving adds a further layer, applied in different months in different hemispheres, and not at all in many countries.