Re:Falsehoods programmers believe about build systems (2012)
by tzs on Saturday July 18, 2020 @05:54PM
(#23885168)
> 2. Compilers will always modify the timestamps on every file they are expected to output : if a write happens why not update mtime? nanosecond precision, what year is it?
It has nanosecond precision, but on most systems it does not have nanosecond resolution.
Note that the difference is either 0 or 0.004000062. This is on a Debian 9 system running on an Amazon Lightsail instance with an ext4 filesystem.
Here's a quick and dirty script to play with this:
C=0
R=0
while :
do
R=$((R+1))
touch a1; sleep $1; touch a2
T1=$(stat a1 | grep Modify | sed -e 's/.*://' | sed -e 's/ .*//')
T2=$(stat a2 | grep Modify | sed -e 's/.*://' | sed -e 's/ .*//')
if [ $T1 != $T2 ]; then
dc <<HERE
20k $T2 $T1 - p
HERE
C=$((C+1))
if [ $C -eq 100 ]; then
echo "$R runs"
exit 0
fi
fi
done
It has nanosecond precision, but on most systems it does not have nanosecond resolution.
Note that the difference is either 0 or 0.004000062. This is on a Debian 9 system running on an Amazon Lightsail instance with an ext4 filesystem.Here's a quick and dirty script to play with this:
Output on the above system: and on a VMWare Fusion VM running Debian 8 on my Mac: