Has the GNU coreutils stat tool changed

coreutilsgnustat

Has the GNU coreutils (8.6) version of stat changed? After a recent update, some scripts I wrote that call stat are not working as expected; in particular, I had been making use of stat -c %Y "${filename}". This is supposed to return the time of last modification in the form of seconds since "Epoch". However, I could have sworn this used to take the form of a whole integer. However, I'm now getting output from this of the form 1287630625.956667227 rather than 1287630625. Since Bash can't handle floating point arithmetic, this is a litttle annoying. Is this a deliberate change? Or a bug? Or has my memory gone fuzzy? I tried searching for information on this, but couldn't find anything.

Best Answer

stat: print timestamps to full resolution was committed to coreutils-8.6.

$ git clone git://git.savannah.gnu.org/coreutils.git
$ cd coreutils
$ git log -1 --grep=time -- src/stat.c
commit 9069af45e691d1252c727da66aa4f3f3c7f1ea29
Author: Eric Blake 
Date:   Thu Sep 30 16:42:13 2010 -0600

    stat: print timestamps to full resolution

    * src/stat.c (epoch_time): New function.
    (print_stat): Use it for %[WXYZ].
    * NEWS: Document this.
    * tests/touch/60-seconds: Adjust test to match.
    * tests/misc/stat-birthtime: Likewise.
$ git describe --contains 9069af4
v8.6~29
Related Question