diffutils: Patching Timestamps
10.5 Updating Timestamps on Patched Files
=========================================
When 'patch' updates a file, it normally sets the file's last-modified
timestamp to the current time of day. If you are using 'patch' to track
a software distribution, this can cause 'make' to incorrectly conclude
that a patched file is out of date. For example, if 'syntax.c' depends
on 'syntax.y', and 'patch' updates 'syntax.c' and then 'syntax.y', then
'syntax.c' will normally appear to be out of date with respect to
'syntax.y' even though its contents are actually up to date.
The '--set-utc' ('-Z') option causes 'patch' to set a patched file's
modification and access times to the timestamps given in context diff
headers. If the context diff headers do not specify a time zone, they
are assumed to use Coordinated Universal Time (UTC, often known as GMT).
The '--set-time' ('-T') option acts like '-Z' or '--set-utc', except
that it assumes that the context diff headers' timestamps use local time
instead of UTC. This option is not recommended, because patches using
local time cannot easily be used by people in other time zones, and
because local timestamps are ambiguous when local clocks move backwards
during daylight-saving time adjustments. If the context diff headers
specify a time zone, this option is equivalent to '--set-utc' ('-Z').
'patch' normally refrains from setting a file's timestamps if the
file's original last-modified timestamp does not match the time given in
the diff header, of if the file's contents do not exactly match the
patch. However, if the '--force' ('-f') option is given, the file's
timestamps are set regardless.
Due to the limitations of the current 'diff' format, 'patch' cannot
update the times of files whose contents have not changed. Also, if you
set file timestamps to values other than the current time of day, you
should also remove (e.g., with 'make clean') all files that depend on
the patched files, so that later invocations of 'make' do not get
confused by the patched files' times.