Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Perl - Was unix time conversion function
Ok Jared, I'm going to buy your book and give it ONE MORE TRY.
I shall report my progress here.
RF
-----Original Message-----
Jared.Still_at_radisys.com
Sent: Tuesday, January 28, 2003 11:51 AM
To: Multiple recipients of list ORACLE-L
Robert,
Perl isn't really that hard.
As with any language, it can be difficult to grasp at first, but once you begin to understand it, it can be extremely powerful.
Regarding Cary's comments about the difficulty of complex Perl data structures, I would have to say that they aren't any more difficult than complex C data structures.
Data::Dumper is your friend. It can be used to print the contents and structure of any Perl data structure so that it is more easily understood.
As for Stephen Lee's comments that there's no need for Perl if you have ksh: I'll bet Stephen has a toolbox in his garage that contains a single flat blade screwdriver and no phillips screwdrivers nor any wrenches. ;)
You can do most anything in ksh: I know, I've done it. Then I learned Perl.
Jared
"Robert Freeman" <robertgfreeman_at_YAHOO.COM>
Sent by: root_at_fatcity.com
01/27/2003 10:39 PM
Please respond to ORACLE-L
To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> cc: Subject: Perl - Was unix time conversion function
Cary.... I once thought I wanted to do some Perl coding... So I bought a book and started to play with it. It made my head bleed... literally I had little droplets of blood emerging from my head.... They rushed me to the hospital and put me in the Perl ward where I languished for days on IV's of Mountain Dew and pulverized Ritz crackers..... it was close.
In my mind there is nothing obvious about Perl, this coming from and old C coder who did pointers and linked lists in his sleep years ago. I don't know, maybe I was having a bad day and it's time to get my "learning Perl" book out again....
Anyone else feel that way about Perl or am I a lone wolf in a Perl world?
RF
-----Original Message-----
Sent: Friday, January 24, 2003 4:29 PM
To: Multiple recipients of list ORACLE-L
At the risk of stating the obvious, doing it in Perl looks like this:
#!/usr/bin/perl
use Date::Format qw(time2str);
my $t = 1043447100; # for example
print time2str("%T %A %d %B %Y", $t), "\n";
Cary Millsap
Hotsos Enterprises, Ltd.
http://www.hotsos.com
Upcoming events:
- 2003 Hotsos Symposium on OracleŽ System Performance, Feb 9?12 Dallas - RMOUG Training Days 2003, Mar 5?6 Denver - Hotsos Clinic 101, Mar 26?28 London
Kinda...you can change the year to 1970 if you want, this also converts to minutes, not seconds. It is a really ugly function but it seems to work. You could always use perl.
function f_minutes {
# Funky function I use to calculate the number of minutes since 2000
MIN_YEAR=$( date +"%Y" ) MIN_YEAR=$( expr ${MIN_YEAR} - 2000 ) MIN_YEAR=$( expr ${MIN_YEAR} \* 525600 ) MIN_DAYS=$( date +"%j" ) MIN_DAYS=$( expr "${MIN_DAYS}" - 1 ) MIN_DAYS=$( expr "${MIN_DAYS}" \* 1440 ) MIN_HOURS=$( date +"%H" ) MIN_HOURS=$( expr "${MIN_HOURS}" \* 60 ) MIN_MINS=$( date +"%M" ) MIN_TOTAL=$(( ${MIN_YEAR} + ${MIN_DAYS} + ${MIN_HOURS} + ${MIN_MINS} ))print ${MIN_TOTAL}
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author:
INET: Jared.Still_at_radisys.com
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting servicesto: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Robert Freeman
INET: robertgfreeman_at_yahoo.com
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting servicesto: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Jan 28 2003 - 22:23:59 CST
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
![]() |
![]() |