Now handling BSD stat too

BSD stat (default on Macs) has a different flag for timestamp: `-f %m` instead of `-c %Y`.
The command may fail when determining which one to use, so I moved the `set -e`.