13.7 Modifying Timestamps
Associated with each file is a set of three
timestamps. These timestamps were discussed briefly when we talked about getting information about a file: the
last access time, the
last modification time, and the last inode-change time. The first two timestamps can be set to arbitrary values by the
The values are measured in internal time, namely an integer number of seconds past midnight GMT, January 1, 1970 - a figure that had reached 800-million-something when this book was being written. (Internally, it's represented as a 32-bit unsigned number, and if we haven't all upgraded to 64-bit machines (or beyond), will overflow sometime well into the next century. We have much more to worry about in the year 2000.[ 3 ])
The $atime = $mtime = 700_000_000; # a while ago utime($atime,$mtime,"fred","barney");
There's no "reasonableness" value for the timestamps: you can make a file look arbitrarily old or as though it were modified at some time in the distant future (useful if you are writing science fiction stories). For example, using the $when = time( ) + 20*60; # 20 minutes from now utime($when,$when,"max_headroom"); |
|