LinuxCommandLibrary

zic

Compile timezone information files

TLDR

Compile a timezone file from a directory

$ zic -d [path/to/directory]
copy

Report warnings during compilation of a specific file
$ zic -v [path/to/file].infile
copy

SYNOPSIS

zic [ option ... ] [ filename ... ]

PARAMETERS

-b source
    Backward-compatible source parsing.
Parses input files in a backward-compatible manner, primarily for older tzdata formats.

-d directory
    Specify output directory.
Writes the compiled time zone data files to the specified directory instead of the default system location (e.g., /usr/share/zoneinfo).

-l linkname
    Create a link.
Creates a symbolic link named linkname in the output directory, pointing to the time zone specified in the input file. Useful for creating aliases.

-L leapsecondfilename
    Leap second information file.
Specifies an additional file containing leap second rules to be incorporated into the compiled time zone data.

-p timezone
    Specify POSIX TZ string.
Specifies the POSIX TZ environment variable string for a given timezone, which can be useful for system-wide defaults or specific zone configurations.

-r @offset
    Reference year (obsolete).
Specifies a reference year for offset calculations. This option is largely obsolete and rarely used.

-R @offset
    Reference year with rule data (obsolete).
Similar to -r, but also considers rule data. Also largely obsolete.

-s
    Limit timestamp range.
Limits the range of timestamps generated by the compiler, potentially reducing file size for zones with very distant (pre-1970 or post-2037) rules.

-S
    Strict limit timestamp range.
Similar to -s, but performs more stringent checks and may issue warnings if rules extend too far into the past or future, indicating potential issues with time representation.

-t filename
    Specify type check file (internal).
Specifies a file for internal type checks, typically used during development or testing.

-v
    Verbose output.
Produces more detailed output during the compilation process, showing which zones are being processed and any warnings or errors encountered.

-V, --version
    Print version information.
Displays the version of the zic utility.

-y yearistype
    Specify year type (internal).
Specifies a yearistype value, used for internal purposes during compilation.

--disable-systemtzdata
    Disable inclusion of system time zone data.
Prevents zic from including pre-existing system time zone data in its compilation, useful for custom or isolated builds.

--eta-leap
    Enable ETA leap second handling.
Enables experimental Estimated Time of Arrival (ETA) leap second handling, which is typically for specific or advanced use cases.

--help
    Print help message.
Displays a summary of command-line options and usage information for zic.

DESCRIPTION

The zic command (Time Zone Compiler) is a crucial utility in Linux systems responsible for converting human-readable time zone definitions into a compact, machine-readable binary format. It processes source files containing rules for time zones, including standard time offsets, daylight saving time (DST) transitions, and historical changes.

The compiled output files, typically stored in /usr/share/zoneinfo (or a specified directory), are then used by system libraries (like libc) and functions (e.g., localtime(3)) to correctly determine local time, apply DST adjustments, and handle historical time changes based on the configured time zone. This ensures that applications and services on the system can accurately represent timestamps across different geographical regions and historical periods.

CAVEATS

The accuracy of time functions like localtime(3) relies on correctly compiled time zone data. If time zone rules change (e.g., due to government decisions on DST), the zic command must be rerun with updated source files to ensure the system reflects the latest rules.

The TZ environment variable can override the system's default time zone setting, potentially leading to inconsistencies if not managed carefully. The compiled data might not accurately represent extremely old or future dates if the source data or compilation options (like -s) limit the historical range.

INPUT FILE FORMAT

zic reads time zone definitions from source files, typically found within the tzdata distribution. These files follow a specific format, primarily containing four types of lines that define the time zone rules:

Zone lines: These define a specific time zone, including its name (e.g., "Europe/London"), the standard offset from UTC, and the set of rules (often referring to a Rule line) that govern daylight saving time transitions for that zone.

Rule lines: These specify the rules for daylight saving time (DST) adjustments. They define when DST starts and ends, the amount of time to adjust (e.g., +1 hour), and the abbreviation to use for the time zone during that period.

Link lines: These create aliases or symbolic links for existing time zones. For instance, a Link line might make "America/New_York" an alias for "America/Nipigon" if they share the same rules, or provide backward compatibility names.

Check lines: These are used for internal consistency checks within the source data, helping maintain the integrity and accuracy of the time zone database.

HISTORY

The zic command is an integral part of the IANA (Internet Assigned Numbers Authority) Time Zone Database, often referred to as the Olson database. This database, initiated by Arthur David Olson, provides a comprehensive collection of worldwide time zone rules and historical data. zic was developed to compile this human-readable data into the binary format used by most Unix-like operating systems. Its existence allows operating systems to provide accurate time zone information globally and handle complex historical changes, making it a cornerstone for consistent timekeeping on computing systems.

SEE ALSO

zdump(8), tzfile(5), ctime(3), tzselect(8), date(1)

Copied to clipboard