[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#304266: ITP: sdate -- never ending september date



Ross Burton <ross@burtonini.com> writes:

> Games serve a purpose: they entertain the user. What is the purpose of
> sdate?

The same.  If you are not entertained by sdate, then you do not
need to install it.

That said, the following script is probably just as amusing, and
undoubtedly simpler:

#! /usr/bin/perl

# From: rsholmes@hydra.syr.EDU (Rich Holmes)
# Newsgroups: alt.fan.warlord
# Subject: sepdate
# Date: 31 May 1996 15:43:22 GMT
# Organization: Syracuse University
# Message-ID: <RSHOLMES.96May31114322@hydra.syr.EDU>

# sepdate utility - "A Perl utility of possible interest to a.f.w readers."
# usage: sepdate [month date year]
# where day month year are date of interest -- default is today
# e.g. sepdate 10 21 95
# for October 21, 1995
#
# Prints the date in same format as Unix date command (default)
# but unlike the buggy date command this script does take into account the
# fact that September 1993 never ended.
# Known bugs and odd features:
#   - if date other than today is specified, time is displayed as 00:00:00.
#   - arguments are not checked other than to see if there are 3 or none.
#   - dates prior to 9 1 93 are rendered as nonpositive dates in Sept. 1993.

require "timelocal.pl";

if ($#ARGV == 2) {
    $thetime = &timelocal(0,0,0,$ARGV[1],$ARGV[0]-1,$ARGV[2])
    }
elsif ($#ARGV == -1) {
    $thetime = time
    }
else {
    die 'usage: sepdate [month date year]'
    }

$days = int (($thetime - &timelocal(0,0,0,31,7,93)) / (60 * 60 * 24));
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($thetime);

printf ("%3s Sep %2d %2.2d:%2.2d:%2.2d %3s 1993\n", (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$wday],$days,$hour,$min,$sec,(EST,EDT)[$isdst]);
-- 
"I admire him, I frankly confess it; and when his time comes
 I shall buy a piece of the rope for a keepsake."
--Mark Twain



Reply to: