So today's the Solemnity of the Assumption, which means this freelancer takes the day off. And what better way to spend free time than to take time to blog about time? About altering your very conception of time. In short, about fuzzy time.
"Fuzzy time" means using phrases like "half past three" and "quarter to one" instead of 3:37 or 12:41. This casual rounding happens all the time in conversation, but internally, I at least tend to watch the minute hand, if not the second hand. What does that do to my sense of time passing?
You may suppose me, for the sake of argument, sitting at lunch in one of those quick-lunch restaurants in the City where men take their food so fast that it has none of the quality of food...They all wore tall shiny hats as if they could not lose an instant even to hang them on a peg, and they all had one eye a little off, hypnotised by the huge eye of the clock. In short, they were the slaves of the modern bondage, you could hear their fetters clanking. Each was, in fact, bound by a chain; the heaviest chain ever tied to a man--it is called a watch-chain.
Chesterton, "The Angry Street"
I remember my Spanish teacher explaining that when North Americans are waiting for someone, they get irritated in five-minute increments, but Central Americans tend to get irritated in increments of a half hour. Of course, as a freelancer on a computer, the tardiness I'm generally fuming at is my own. That's an awful lot of angry energy to be wielding all the day long; I'm on both the giving and the receiving end.
A computer is singularly equipped to provoke this malaise because a tiny clock can be so conveniently placed in constant view. Chesterton, I think, would have turned his screen clock off entirely, with a mild oath, but I decided to try a pleasant compromise. More than a compromise, perhaps; for already my fuzzy clocks are getting me to think in terms of "five to ten" and "half past six". With no clock at all, I'd probably still be incessantly wondering (and checking) the "real" time.
I first found out about fuzzy time during the brief fuzzy-headed time when I was running KDE. The clock on the KDE panel has a fuzzy time setting. I don't remember the exact way to set it, but I'm sure you can find out how easily enough if you want. There may be similar settings on Windows and Mac applications. I saw at least one "Fuzzy Clock" Mac app in my searches. But of course I must leave that sort of thing to those who want it.
A fuzzy clock for Firefox
If you spend a lot of time browsing, Firefox is a great place to put your first fuzzy clock. The Fuzzy Time addon puts a "fuzzy clock" in your status bar. You can set the fuzziness level, and even learn a little bit of Spanish or Hebrew by choosing a different locale.
A fuzzy clock on your bash prompt.
But if you spend lots of time on the command line, you'll
want fuzzy time on the prompt. First, we'll need a command
line tool that simply spits out the current fuzzy time, and
there's already a great one in Python.
I'm not sure I found
the site of the original source, but I got myself a copy of
fuzzyclock
here
(sig)
and it works. It installs like any normal Python script, and
also lets you set the fuzziness level.
fuzzyclock
gives you the time in a five-minute increment, while
fuzzyclock -f 2
gives a fifteen-minute increment, and
fuzzyclock -f 3
only tells the hour. I'll leave level 4 for you to discover.
Now, how do we get this to show on our prompt? The default bash prompt is usually something like:
you@yourhost $
Of course, you can set this to something more interesting by
setting the PS1 variable. You can try it right now with
export PS1="Hi, Mom, I'm in \w and it's \t $ "
Usually, this variable is set in your $HOME/.bashrc or
$HOME/.bash_profile or whatever gets sourced when you log
in. The \w prints your current working directory, and the
\t prints the time. If you fire up man bash and scroll down to
PROMPTING, you'll find all kinds of neat codes you can use
in PS1 to give you other updated information. This is probably worth
a look if you've never customized your prompt. You can even
do colors (though that's another post).
Until recently, I'd had the prompt displaying the "real", or rather conventional, time for years. Every command reiterated the current minute, and it could start to feel like a death by a thousand cuts.
So how can we replace this with the soothing continuity of
fuzzy time? There's another secret bash variable called
PROMPT_COMMAND, which will get run every time you hit
Enter and get a new prompt. If you use PROMPT_COMMAND to
export a new value PS1, you can update your prompt every
time.
Now, the obvious thing to do is this:
PROMPT_COMMAND='export PS1="\u$( fuzzyclock ) $"'
(Note \u for user; you can put whatever other text you
want in the prompt.) However, this technique will cause a
slight delay, as fuzzyclock has to get called every time
you hit Enter. This gets frustrating quickly. Also, unless
you only run one command every fifteen minutes, it seems
out of line with the overall fuzzy time concept.
Fortunately, bash can cat a short file very quickly. (It
could probably display an environment variable even more
quickly, but, embarrassingly, I couldn't get that to work
with a cron job.) So all we need to do is write a short
script that saves the current time in a short file, and then
use cron to run that script every minute (or fifteen). Then,
we use PROMPT_COMMAND to display this short file whenever
we get a prompt.
First, in your $HOME/.bashrc (or $HOME/.bash_profile):
PROMPT_COMMAND='export PS1="\u$( cat $HOME/.cronprompt ) $ "'
Put whatever else you want in that PS1, remember.
Then in your crontab file (perhaps $HOME/.crontab):
*/1 * * * * /PATH/TO/cronprompt.sh &> /dev/null
*/1 means once a minute, which I think is often enough for
our fuzzy purposes. You could run it every five minutes
(*/5) if you're extremely jealous of wasted CPU cycles.
The &> /dev/null is rather important, unless you want an
confirmation email every minute.
Don't forget to update cron by
crontab $HOME/.crontab
or wherever your put your crontab file. Just changing your
crontab file won't do anything without actually running
crontab on it. You can check that it "took" with crontab
-l.
You'll need cronprompt.sh actually to be where
you told cron it is. This script can be as short as one
line:
echo ": {$( fuzzyclock )}" > $HOME/.cronprompt
Whenever cron runs cronprompt.sh, .cronprompt is
updated. Thanks to our setting for $PROMPT_COMMAND above,
.cronprompt gets output afresh every time you get a
prompt.
You can use this cronprompt.sh concept to add other cool
updated information, such as a reminder using remind, but
I'm going to save that for another post.
(Note: after I did all this, I found a script called uberprompt, which seems to have a similar approach for setting a prompt title on the fly, but I didn't try it.)
A fuzzy clock for Vim
Now that you've gone to all this trouble to have fuzzy time on the command line, why not put it on the status line in Vim?
In your $HOME/.vimrc:
"fuzzytime
function! Cronprompt()
"Note that you must change YOU to your user name.
"For some reason, $HOME doesn't expand in .vimrc, at least for me.
for line in readfile("/home/YOU/.cronprompt",'',1)
return line
endfor
endfunction
se statusline=%-5F %m%r%w%y%=%{strftime('%a %e %b %I:%M %p')}%6L%{'L'}%3{' b'}%n %{Cronprompt()} (%l,%c)%5P
Again, note that you must change YOU to your user name, so
that Vim can find .cronprompt. You don't need all that
stuff I have in statusline, just %{Cronprompt()} (though you
probably want handy items like the name of the file you're
editing). I just thought I'd show you my statusline. Note
that I've kept a strftime function that includes the
conventional time too. This might defeat the purpose, but
presently I still time my work day, and sometimes the Vim
clock helps because it stays "frozen" if I get up from the
computer. Maybe fuzzy time will help me stop this habit. But
see :h statusline if you want to customize this arcane
variable.
Go forth and saunter
I wouldn't be surprised to find that if there were some way of totaling the amount of time I sometimes spend worrying over and checking the time, it would come to fifteen minutes or even a half hour a day. Like all slaveries, a hyper time sense might turn out to be inefficient, even by its own standards. I like fuzzy time so far, and I hope you give it a try.

![[Powered by PyBloxsom]](/img/banners/pb_pyblosxom.gif)