Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

PROGRAMMING CONTEST #1

Name: Anonymous 2009-12-22 23:22

Write a program that outputs the distance of a unix timestamp from the current time in English (e.g., "5 minutes", "1 day", or "8 years").

Judging will be based on:
1. Efficiency
2. Style
3. Whim
4. Smugness

Please provide a sample of what your program does for the lazy.

Name: Anonymous 2009-12-22 23:53

#!/usr/bin/perl

$ufn = (3600 * 24 * 14) / 1000000;
$now = time();
$target = $ARGV[0];
$delta = abs($target - $now)/$ufn;

printf("%.0f microfortnights %s\n", $delta, $target>$now?"from now":"ago");

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List