Strosstime

After reading some Charles Stross recently I got intrigued about his use of what is more or less some sort of metric time. Simply put, you take the SI counting (kilo,mega,giga) and apply it to seconds. So I wrote an ugly a simple function for my Drupal theme and it now shows the time differnce in “strosstime” from posting till right now.

Of course I don't think that this format will catch on but it's an interesting way of looking at time. Once you look at something as a million seconds, it just sounds a bit different than one and a half weeks.

If you want to improve on this, here you go:

function strosstime($timestamp) {
$diff=time() - $timestamp;

if ($diff >= 1000) {
        if ($diff >= 1000000) {
                if ($diff >= 1000000000) {
                        $diff=$diff / 1000000000;
                        $diff=number_format($diff,1);
                        $result=", $diff gigaseconds ago";
                } else {
                        $diff=$diff / 1000000;
                        $diff=number_format($diff,1);
                        $result=", $diff megaseconds ago";
                }
        } else  {

                $diff=$diff / 1000;
                $diff=number_format($diff,1);
                $result=", $diff kiloseconds ago";
                }
        } else {
                $result=", $diff seconds ago";
        }

return $result;
}

Tiny reference table:

1 kilosecond 16.6 minutes
1 megasecond 11.6 days
1 gigasecond 31.7 years

posts: