Node:Patching Time Stamps, Next:Multiple Patches, Previous:Creating and Removing, Up:Merging with patch
When patch
updates a file, it normally sets the file's
last-modified time stamp 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 -Z
or --set-utc
option causes patch
to
set a patched file's modification and access times to the time stamps
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 -T
or --set-time
option acts like -Z
or
--set-utc
, except that it assumes that the context diff
headers' time stamps 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 time stamps 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 -Z
or --set-utc
.
patch
normally refrains from setting a file's time stamps if
the file's original last-modified time stamp 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 -f
or --force
option is given, the file's time stamps 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 time stamps 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.