#!/bin/perl
# sepdate utility
# 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]);
--
*/\/\/\/\/\* fnord. *"I..." - N. Peart* * o=|=====> / * VR O INGSI! *
?| |? O ! O ? "SometimesWithA ? * * ?K#:1 // ? _ \ _ _/-_|\ ?
*| |*O !O *QuoteFromMe"- him* * * \\ // * (_)/ (_) | | ?
?| O O |? O! O?|<||3() |S G()|)!? WPI 77 ? \X/-'-,-@ PERTH-->*_-__/ ?
"31,7,93"? What about the August before?
Shouldn't this be "31,8,93"?
Anyway, with "31,8,93" you get:
$ sepdate 6 28 96
Fri Sep 1000 00:00:00 EDT 1993
Sven ["Did I hear someone say PARTY?"]
--
June 28 1996
alt.fan.warlord September Party
>rsho...@hydra.syr.EDU (Rich Holmes):
>> $days = int (($thetime - &timelocal(0,0,0,31,7,93)) / (60 * 60 * 24));
>
>"31,7,93"? What about the August before?
> Shouldn't this be "31,8,93"?
"All array elements are numeric, and come straight out of a struct tm.
(That's a bit of C programming lingo -- don't worry about it.) In
particular this means that $mon has the range 0..11 and $wday has the
range 0..6. (You can remember which ones are 0-based because those
are the ones you're always using as subscripts into 0-based arrays
containing month and day names.)"
>Anyway, with "31,8,93" you get:
>
>$ sepdate 6 28 96
>Fri Sep 1000 00:00:00 EDT 1993
And you also get:
% sepdate 9 1 93
Wed Sep -30 00:00:00 EDT 1993
>Sven ["Did I hear someone say PARTY?"]
No, you heard someone say "LTWP,YPW!"
*wimper*
: [zoyd] butting$ sepdate
: Fri Sep 4000 23:30:22 EST 1993
: [zoyd] butting$ sepdate 5 31 1996
: Fri Sep 1004 00:00:00 EST 1993
HappyNet NOW, dammit.
butting (and a very happy 4000th to all of y'all now, 'k?)
-wimpest-
>: [zoyd] butting$ sepdate
>: Fri Sep 4000 23:30:22 EST 1993
>: [zoyd] butting$ sepdate 5 31 1996
>: Fri Sep 1004 00:00:00 EST 1993
>
>HappyNet NOW, dammit.
You're soaking in it!
>butting (and a very happy 4000th to all of y'all now, 'k?)
Dave "and many happy RETURNs" DeLaney
--
\/David DeLaney posting from d...@vic.com "It's not the pot that grows the flower
It's not the clock that slows the hour The definition's plain for anyone to see
Love is all it takes to make a family" - R&P. VISUALIZE HAPPYNET VRbeable<BLINK>
http://www.vic.com/~dbd/ - net.legends FAQ & Magic / I WUV you in all CAPS! --K.
I calibrated my celebration by having a bit of cheap but good Pinot
Noir and Indian. Mmm. What's that saying about Mango Sorbet?
Also: I am ashamed to admit that I have been counting down every day
since Tue Sep 3990 10:05:02 EST 1993, but missed
Fri Sep 4000 22:17:07 EST 1993.
Also Also: I be demanding to know why you are too on the EST
timezone. Damn you all who live in Eastern XXXX.
--
TimC -- http://astronomy.swin.edu.au/staff/tconnors/
"Mango sorbet is clearcut proof that we have progressed beyond the
bare needs of survival and have progressed to the transcendant."
- Marc Goodman in talk.bizarre
> Also Also: I be demanding to know why you are too on the EST
> timezone. Damn you all who live in Eastern XXXX.
Hmm, I dunno why I didn't list in the 'bugs' comments the fact that
sepdate assumes your time zone is either EST, if you're not on
daylight savings time, or EDT, if you are.
--
*/\/\/\/\/\* fnord. *"I..." - N. Peart* * o=|=====> / * VR O X-warlord:no*
?| |? O ! O ? "SometimesWithA ? * * ?K#:1 // ? _ \ _ _/-_|\ ?
*| |*O !O *QuoteFromMe"- him* * * \\ // * (_)/ (_) | | ?
?| O O |? O! O?|<||3() |S G()|)!? WPI 77 ? \X/-'-,-@ INGSI! *_-__/ ?
Ahhh:
It seems my endlessseptember.1 (endlessseptember is a ruby script, but
I don't have ruby installed:
#!/usr/bin/env ruby
require 'date'
print Time.now.strftime "%a Sep #{Date.today-Date.new(1993,8,31)} %H:%M:%S %Z 1993"
print "\n"
)
came from you originally, and then made it half way around UNSENET via
rec.humor.oracle.d with a vital change:
#!/usr/bin/perl
# Adapted and updated from a version attributed to Rich Holmes
use Time::Local;
use POSIX qw(strftime);
if ($#ARGV == 2) {
$todmon = $ARGV[0]-1;
$todday = $ARGV[1];
$todyr = $ARGV[2];
$todti = timelocal(0, 0, 0, $todday, $todmon, $todyr);
} elsif ($#ARGV == -1) {
$todti = time;
} else {
die;
}
$septime = timelocal(0, 0, 0, 31, 7, 93);
$tdiff = $todti - $septime;
$days = int ($tdiff / (60 * 60 * 24));
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
# this seems like overkill
$tzstr = strftime("%Z", $sec, $min, $hour, $mday, $mon, $year);
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,$tzstr);
Yay! For $tzstr!
--
TimC -- http://astronomy.swin.edu.au/staff/tconnors/
Bus error -- driver executed.
Welcome to the Eastern Standard Tribe.
Adam
> >Also Also: I be demanding to know why you are too on the EST
> >timezone. Damn you all who live in Eastern XXXX.
>
> Welcome to the Eastern Standard Tribe.
The pr0n industry wakes up at 7 A.M. EST. It takes
about three hours to go fwap-fwap-fwap all the way
to Cali-forn-i-a.
Rinse, lubricate, repeat.
--oTTo--
If you want to get laid, don't masturbate
Here's a patch to your original:
--- sepdate.pl.orig 1996-05-31 16:43:22.000000000 +0100
+++ sepdate.pl 2004-08-13 20:31:29.000000000 +0100
@@ -44,7 +44,7 @@
($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]);
+(Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$wday],$days,$hour,$min,$sec,strftime('%Z',localtime));
# --
Nick
--
"And we will be restoring neurotypicality just as soon as we are sure
what is normal anyway. Thank you". -- not quite DNA
> Here's a patch to your original:
>
> --- sepdate.pl.orig 1996-05-31 16:43:22.000000000 +0100
> +++ sepdate.pl 2004-08-13 20:31:29.000000000 +0100
> @@ -44,7 +44,7 @@
> ($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]);
> +(Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$wday],$days,$hour,$min,$sec,strftime('%Z',localtime));
Needs a 'use POSIX qw(strftime);', though, doesn't it?
I wuz gonna say "'cos I'm too damn lazy to edit in NZST/NZDT", but
then Rich owned up:
> Hmm, I dunno why I didn't list in the 'bugs' comments the fact that
> sepdate assumes your time zone is either EST, if you're not on
> daylight savings time, or EDT, if you are.
--the $500 bounty for bugs applies, right?
butting
>-(Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$wday],$days,$hour,$min,$sec,(EST,EDT)[$isdst]);
>>
>+(Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$wday],$days,$hour,$min,$sec,strftime('%Z',localtime));
>
>Needs a 'use POSIX qw(strftime);', though, doesn't it?
That's in the version I saved ... I might have applied someone else's
patch, but can't be mine as I didn't know perl until just but recently.