1. lahorichargha
  2. dtime

Overview

dtime

Hello there! This is a silly simple bash implementation of the time distance in words helper functions of rails.

examples

$ dtime yesterday
a day
$ echo "This project was created $(dtime 'Sun Nov 27 09:00:39 IST 2011') ago"
This project was created about an hour ago

dtime can take a second argument which is the to_time, and defaults to now

usages

It is intended to be used in other scripts or shell utilities to show human readable time differences.

Currently, this is used in my ti project, which is a command line time tracker. ti uses dtime to display nice human readable time information.

I also use it in my mutt's display-filter to show me the recieved time of a mail in a humane way. I'll write a blog post about this one of these days.

get it

$ wget https://bitbucket.org/sharat87/dtime/raw/tip/dtime
$ chmod +x ./dtime

You will almost always want to put this file in your $PATH. ~/bin is a good choice :)