Unless the build timezone is made part of the build environment, care must be taken to get the build output when the build is run in two different timezones.
Avoid writing the current timezone
Some tools will write date and time with the associated timezone:
Despite being given a pre-determined time in the form of a Unix time (also called epoch), this output would fail to be reproducible in a different timezone than UTC+0100. The easy solution is to set the required environment variable to force tools to use UTC as the timezone:
When there is no dedicated option, it is most often possible to set the
A related concern is for formats which don’t contain timezone information. Zip archives are a good example: the same timezone must always be used to unpack them to prevent variations on the file modification times.
Use date string with timezone information
Time strings like “Wed, 21 Oct 2015 11:18:50” are inherently ambiguous. Which timezone does it use? How should it be understood?
In the context of reproducible builds, it’s best if time strings all contain timezone information. A fallback option is to assume they are all specified as UTC.
If time strings without timezone specification are parsed in the timezone of the build system, hard to understand behavior might happen. An example is doing time difference computations in timezones with different daylight saving changes. As different timezones have different policies, a user might get more or less hours depending on the timezone used to perform the build.
Achieve deterministic builds
- Deterministic build systems
- Volatile inputs can disappear
- Stable order for inputs
- Value initialization
- Version information
- Archive metadata
- Stable order for outputs
- Build path
- System images
Define a build environment
- What's in a build environment?
- Recording the build environment
- Definition strategies
- Proprietary operating systems
Distribute the environment
Follow us on Twitter @ReproBuilds & Reddit and please consider making a donation. Content licensed under CC BY-SA 4.0, style licensed under MIT. Templates and styles based on the Tor Styleguide. Logos and trademarks belong to their respective owners. Patches welcome via our Git repository (instructions) or via our mailing list.