Skip to content

Instantly share code, notes, and snippets.

@jblaine
Created May 22, 2012 18:22
Show Gist options
  • Save jblaine/2770749 to your computer and use it in GitHub Desktop.
Save jblaine/2770749 to your computer and use it in GitHub Desktop.
Mickey Mouse Watch
#!/usr/bin/env perl
#
# Author: Jeff Blaine
# Date: 09/16/96
# Version: 1.0
#
# Figures out the current time and outputs the information as if you were
# reading a Mickey Mouse watch.
#
# Originally based on sh/expr/awk code written by the same author around
# 1992 (lost code)
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
if ($hour >= 13) {
$hour -= 12;
}
if ($min >= 30) {
$hh_loc = "between the " . $hour++ . " and the $hour";
} else {
$hh_loc = "on the $hour";
}
if ($min <= 5) {
$sh_loc = "1";
} elsif ($min <= 10) {
$sh_loc = "2";
} elsif ($min <= 15) {
$sh_loc = "3";
} elsif ($min <= 20) {
$sh_loc = "4";
} elsif ($min <= 25) {
$sh_loc = "5";
} elsif ($min <= 30) {
$sh_loc = "6";
} elsif ($min <= 35) {
$sh_loc = "7";
} elsif ($min <= 40) {
$sh_loc = "8";
} elsif ($min <= 45) {
$sh_loc = "9";
} elsif ($min <= 50) {
$sh_loc = "10";
} elsif ($min <= 55) {
$sh_loc = "11";
} elsif ($min <= 59) {
$sh_loc = "12";
} else {
$sh_loc = "AIEEE BROKEN SCRIPT";
}
print "Mickey's small hand is ", $hh_loc, ", and Mickey's big hand is near the ", $sh_loc, ".\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment