A couple nights ago, while on Freenode, lilo (Rob Levin) posted a small log of a chat in the channel, and I noticed that he was using the Unix Epoch time as his timestamp in his IRC client irssi. I thought that was genious, so I set out to code an irssi script that shows binary timestamps. Seeing as though I am still relatively new to Perl, I knew this would be a challenge, but I figured it wasn't too difficult to handle. So today, I set out to code such a script.
The first thing for me, again, because of my n00b skills, was to create a stand-alone program that converted the system time to a binary string representation. I wanted to test and retest that the conversion worked perfectly before testing it in irssi and crashing the program.
So here was what I had in mind:
- Get the hours and minutes from the localtime on the system.
- Convert the hours to a binary string.
- Convert the minuts to a binary string.
- Concatenate the binary strings together with the colon time seperator.
- Store the concatention in the irssi timestamp variable.
The first four steps took no time at all. I could print them to the console and see the results. The wall that I hit was trying to hook it into irssi. I had no idea where to begin with that. So I figured I'd start looking at other scripts, and figure out exactly how to do it. There was also documentation on the irssi web site for creating brief scripts. Needless to say, it isn't that comprhensive, and I spend more time hacking than learning. I can easily say that learning the syntax and functions took 80% of the time getting this script finished.
Well, it's finished. It's a fairly easy and brief script. Nothing to it really. You can download the whole script here. To execute the script, just /script load binary_time.pl and to unload the script, just /script unload binary_time. I would be interested in feedback on the script, if you wouldn't mind testing it out.
Also, I received a couple emails and a comment on the last post regarding my hacked madcow theme, and if I could post it here. Sure, no problem. Here you go.