Hello All,
I am getting lots of rows from a database where the time stamp has to be evaluated.
I set an off set of 12:00am, so every entry before 12:00 is stays, every date which is after 12:00 is beeing put forward by 24hours.
That way I report from 12:00am to 12:00am rather that 0:00 to 0:00.
Iam using Date::Manip but is is just a bit slow and I was wondering if there a faster / simpler way.
while (@row = $sth->fetchrow_array ){
($host,$pol,$sched,$date,$target,$error)=@row[0,1,2,3,4,5];
$cutover=(split /:/,$time)[0];
if ($date=~/\s(\d{2})/){
$hour=$1;
}
#print "========= CUTOVER: $cutover DATE: $date HOUR: $hour ==
+======\n";
if ($hour > $cutover){
## 12 hours are added to push the backup into the new repo
+rting window (next day)
$date=DateCalc("$date","+24 hours"); ###Takes 2min out of
+2:30min.
$date=&UnixDate($date,"%Y-%m-%d");
#print" This backup has moved to the next day: $date\n";
}else{
$date=(split /\s/,$date)[0];
#print" This backup has stayed: $date\n";
}
if (defined ${$report{$host}{$pol}{$sched}{$date}}){
${$report{$host}{$pol}{$sched}{$date}}=${$report{$host}{$p
+ol}{$sched}{$date}}+$error;
}else{
${$report{$host}{$pol}{$sched}{$date}}=$error;
}
}
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.