Why does Java have support for time zone offsets with seconds precision?

Solution 1:

It's not supported by ISO-8601, but it is a valid offset as recorded in the IANA time zone database.

Sub-minute offsets are common in the data for the late 19th and early 20th century, before time zones were properly standardized. For example, Europe/Paris had an offset of +00:09:21 until 1911 (according to the IANA database).

The latest occurrence I can find for this is Africa/Monrovia which had a sub-minute offset until 1972!

Solution 2:

One reason for extra precision is that the national timezones we're all familiar with aren't the end of the story.

If you have a look at the "See also" section under Wikipedia's article on UTC you'll see a selection of time standards that have second (and even fractional second) offsets from UTC.Of particular interest is TAI (International Atomic Time) on which UTC is based. The difference is 37 s at the moment, as UTC includes leap seconds and TAI doesn't. Thus to support the parent standard requires second-level precision.

GPS time is also offset from UTC by a number of seconds (the offset with respect to TAI is fixed at 19 s). GPS time and TAI (or its other derivatives) are important for navigation, telecoms/broadcast and space science.

Once you get into astronomy things get even more complicated. Terrestrial time (Wikipedia) has a fractional offset from more common scales: TT ≅ TAI + 32.184 s (to millisecond precision; TT is much more complicated than that).

Further reading as it hasn't been linked from this question yet: Falsehoods programmers believe about time (and timezones, dates, etc.) - includes some interesting background.