Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

n1vux (1492)

n1vux
  (email not shown publicly)
http://boston.pm ... x.cgi?BillRicker
AOL IM: n1vux (Add Buddy, Send Message)
Yahoo! ID: n1vux (Add User, Send Message)

Only started with Perl4 and Perl5 in 1995. I was doing AWK etc for 12 years before that, and resisted switching. I've been doing OO since before C++ hit bigtime, with Objective-C and SmallTalk, so I really like the (no longer new) Perl5 OO style; and the Lispish Map style is also an old friend. What do I hack with Perl? All data that passes my way; systems monitoring scripts at $DayJob, weather data at night, and I cheat on NPR word puzzles. Member: Boston.pm.org [pm.org] BLU.org [blu.org] /. LinkedIn [linkedin.com]

N1VUX is my FCC-issued ham radio callsign.

Journal of n1vux (1492)

Tuesday March 29, 2005
08:03 AM

Happy "BILL" o'Clock

[ #23904 ]
[Elaborating on the original report at http://use.perl.org/comments.pl?sid=25547&cid=39001 ]

This morning, at 123836GMT/ 7:38:36 EST, the Unix time_t value was (in Network standard byte order) "BILL", that being the ASCII representation of the 32bit number of seconds since New Years 1970.

BILL  Tue Mar 29 12:38:36 2005 GMT . Tue Mar 29 07:38:36 2005 ET

So happy BILL-o-clock to all the Bill's in my address book.

Also upcoming is Bill-o-clock and a bunch of other 4-letter words.

BYTE  Sun Apr 10 16:28:53 2005 GMT . Sun Apr 10 12:28:53 2005 ET
Beer  Tue Apr 19 20:09:22 2005 GMT . Tue Apr 19 16:09:22 2005 ET
Bill  Fri Apr 22 21:28:12 2005 GMT . Fri Apr 22 17:28:12 2005 ET
Byte  Thu May  5 01:18:29 2005 GMT . Wed May  4 21:18:29 2005 ET

And CAAA-CZZZ, Caaa-Czzz are due in the fall, starting with

CABS  Mon Oct  3 14:38:11 2005 GMT . Mon Oct  3 10:38:11 2005 ET
CAFE  Mon Oct  3 14:55:01 2005 GMT . Mon Oct  3 10:55:01 2005 ET

This runs about 2 letters a year thru

Zoos  Mon Jan 29 19:01:07 2018 GMT . Mon Jan 29 14:01:07 2018 ET

and the lower case doesn't come around for a while ...

abbe  Sun Oct 10 03:47:49 2021 GMT . Sat Oct  9 23:47:49 2021 ET
bill  Wed Apr 27 16:16:44 2022 GMT . Wed Apr 27 12:16:44 2022 ET
zoos  Sat Feb  3 13:49:39 2035 GMT . Sat Feb  3 08:49:39 2035 ET

(which is pretty close to the 2038 32bit time_t rollover, of course.) Short term values relevant to some friends ...

BOYD  Sun Apr  3 02:47:32 2005 GMT . Sat Apr  2 21:47:32 2005 ET
BUCK  Thu Apr  7 14:27:23 2005 GMT . Thu Apr  7 10:27:23 2005 ET
BYRD  Sun Apr 10 16:20:20 2005 GMT . Sun Apr 10 12:20:20 2005 ET
Boyd  Wed Apr 27 11:37:08 2005 GMT . Wed Apr 27 07:37:08 2005 ET
Buck  Sun May  1 23:16:59 2005 GMT . Sun May  1 19:16:59 2005 ET
Byrd  Thu May  5 01:09:56 2005 GMT . Wed May  4 21:09:56 2005 ET

========================

#! /usr/bin/env perl -l
### Copyright - 2005 William Ricker / N1VUX
### License - Same as Perl
### Purpose - Find Words that are time_t's or vice versa

use warnings;
use strict;
use English qw{-no-match-vars};

## ARGS
our $Char=q{B}; ##Default because BILL'o'Clock is what I want
my $arg = shift @ARGV;
$Char=$arg if defined $arg and $arg =~ m{ \A \w{1} \Z }xsmi;
our $IsUC = $Char =~ /[A-Z]/ ? 1 : 0;

our %Time_of;
sub bytes_to_nums {
    my $string=shift;
    ## Probably has problems if given more than 4 chars?
    my $long=unpack("N*",pack("a*",$string));
    return $long;
}

sub keep_it {
    my $time_in=shift
        or die "keep_it requires arg";

    our %Time_of;

    my ($Baaa,$BAAA)=($time_in, ($IsUC ? uc $time_in : lc $time_in));
    $Baaa =~ s/^$Char/$Char/i; ## Force capital

    my $timet=bytes_to_nums($Baaa);
    $Time_of{$Baaa}=$timet;

    if ($Baaa ne $BAAA) {
        $timet=bytes_to_nums($BAAA);
        $Time_of{$BAAA}=$timet;
    }
}

## Friends ##
keep_it("Boyd") if $Char eq q{B};
keep_it("Byrd") if $Char eq q{B}; # is in Larry,Jim,Henry

### @TBD -- we could optionally use other dictionaries
open my $DICT, '<', '/usr/dict/words'
    or die "Dict open fails $OS_ERROR";

while (<$DICT>) {
    chomp;
    next unless m{ \A $Char \w{3} \Z }xism; ## B... only
    keep_it($_);
}

for my $word (sort keys %Time_of){
    my $timet=$Time_of{$word};
    my ($gmt, $localt)=(scalar gmtime $timet, scalar localtime $timet);
    print qq{$word  $gmt GMT . $localt ET}
}

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.