Why File Time Stamps Are Unreliable

I'm time stamp crazy. I append time stamps everywhere. If my wife had not intervened, my daughter would have received a time stamp in the delivery room. Occasionally I wonder if there's any reason for this madness. Today I received a gentle reminder of why I do this.

I accidentally hit ⌘-A and DEL while browsing my notes in NVAlt. Whoops. All files deleted! Not to worry. ⌘-Z returned all of them, except with new file timestamps.

Lesson: File time stamps are unreliable and fragile.

Luckily, many of my text notes in NVAlt have a time stamp header line. Almost all of my binary files have time stamps in the file name. I have a couple recommendations for anyone interested in using time stamps more liberally.

Use Sortable Time Stamps

I use a format like

2012-07-19_082858
which is Year-Month-Day_HourMinuteSecond. In a directory full of files that are prefixed with a time stamp, they are easily sortable.1

Stamps like

July 19, 2012 8:28:58am
are not chronologically sortable. They are more readable but to a file system, "August" sorts before "July".

Use the same format

Where possible, use the same format. This is important for sorting files, but it also helps to train the eye to quickly recognize the date.

Use a format that is widely supported

I chose a format that is easily generated from the Shell and Python. Colons, semicolons, braces, parentheses, quotes, dots, ampersands, etc. all have different meanings in different systems. Some require escapes and some are just not supported. Something to think about while trying to be clever.

TextExpander

For the love of Science, use TextExpander.


  1. I occasionally forget to use the dashes. I hate my past-self with a passion.