Verify if endtime column in textfile meets certain criteria then update XML file

Richard Kreidl
Richard Kreidl used Ask the Experts™
on
I have a script from an earlier EE posting solution that generates the textfile below.
http://www.experts-exchange.com/Programming/Languages/Scripting/Perl/Q_27218653.html

The columns in the textfile are delimited by one or more spaces. The file is generated every 15 minutes using an UNIX scheduling software.

I would like to combine the earlier script with new code that verifies if the enddate(col.5) and endtime(col.6) is within 15 minutes of the current system date and time and also the status field(col.7) is designated as "SU" meaning successful.

If that is all true then update the XML file using the xmlname(col.1) in the proper XML element in the file with the endtime but I need it converted to an am and pm format.

COMP commisnsDlyCompTransLoadBox             08/05/2011  21:43:35 08/05/2011  21:48:07 IN 16690634/0    
CMHM ctmhmHistMartComplete                          08/05/2011  04:37:37 08/05/2011  04:37:40 SU 16682425/1    
DISTM distdssMthCOMPDistDMCalc                    07/30/2011  12:14:54 07/30/2011  14:08:27 IN 16629891/1    
DISTS distdssSemiMthCOMPDistDMCalc             08/06/2011  12:35:39 08/06/2011  12:53:37 IN 16695368/0    
ES00014 commisnsECSXenosClearRiskFile        08/06/2011  11:45:03 08/06/2011  11:45:46 IN 16695100/0    
FMI fieldrptChkRpts                                            08/06/2011  03:04:27 08/06/2011  03:04:41 SU 16692427/1    
GDC fieldrptDCMPGDCRptBox                             08/05/2011  20:05:10 08/05/2011  20:38:25 SU 16689988/1    
ICCA commisnsDlyIncmPostCalcLoadBox           08/05/2011  20:46:20 08/05/2011  21:43:27 IN 16690255/0    
ICTM commisnsDlyFeedForICM                           08/05/2011  19:00:07 08/05/2011  19:00:41 IN 16689367/0    
NITECOMM commisnsEndBatchCycleBox            08/06/2011  01:00:16 08/06/2011  05:39:16 IN 16691855/0    
ODSFHR psledgerFinalProcessingBx                  08/06/2011  01:00:23 08/06/2011  03:15:06 SU 16691858/1    
PSF psfinclPymntRecBox                                    08/06/2011  01:30:09 08/06/2011  02:18:59 SU 16692019/1    
PSLDFHR psledgerPSLdBx                                 08/05/2011  23:01:20 08/06/2011  02:23:21 SU 16691195/1    
RPI ctmoperRiskProdComplete                          08/05/2011  04:06:41 08/05/2011  04:06:44 SU 16681701/1    
SALES fieldrptDDMFMIODlySales                        08/06/2011  02:28:14 08/06/2011  04:00:31 SU 16692334/1    
TEEFHR psfinclTEExEeUpdate                            08/05/2011  02:28:39 08/05/2011  02:33:15 SU 16681955/1    
TEPP psfinclTEExStagePmt                                08/05/2011  19:54:07 08/05/2011  19:56:42 SU 16689671/1    
TNC ctmoperOperMartComplete                       08/05/2011  04:08:36 08/05/2011  04:08:39 SU 16681155/1    
SSEC invmtsecOStgProcBx                               08/05/2011  21:51:42 08/05/2011  23:19:41 IN 16690700/0    
SIVU invstwhsDailyBox                                     08/06/2011  03:17:57 08/06/2011  04:10:00 SU 16692657/1  

Here is the XML file layout. As you can see there are XML elements in the file that match up with the xmlname(col.1) from the textfile. I have some times in a couple of the elements for an example on how the data would look like.

<?xml version='1.0' standalone='yes'?>
<MSR>
  <Info>
    <AutoSys></AutoSys>
    <BT30004></BT30004>
    <CICS></CICS>
    <CICST></CICST>
    <CM10009></CM10009>
    <CMHM>4:37am</CMHM>
    <COMP></COMP>
    <CSI>CSI outage report will be sent out by the CSI team on Next Business Day.</CSI>
    <Comment></Comment>
    <DISTM></DISTM>
    <DISTS></DISTS>
    <EBIS>Completed</EBIS>
    <ES00014></ES00014>
    <FADS></FADS>
    <FIXA></FIXA>
    <FM24FHR></FM24FHR>
    <FMDNFHR></FMDNFHR>
    <FMI></FMI>
    <GDC>8:38pm</GDC>
    <ICCA></ICCA>
    <ICTM></ICTM>
    <IMZ></IMZ>
    <IMZT></IMZT>
    <INSH></INSH>
    <LASTISA></LASTISA>
    <LASTSRM1></LASTSRM1>
    <LASTSRM2></LASTSRM2>
    <LASTSRM2A></LASTSRM2A>
    <MADYFHR></MADYFHR>
    <MVS>UR98001 (IM10875226)</MVS>
    <NITECOMM></NITECOMM>
    <ODSFHR></ODSFHR>
    <PAYFHR></PAYFHR>
    <PDBN></PDBN>
    <PSF></PSF>
    <PSLDFHR></PSLDFHR>
    <RPI></RPI>
    <SALES></SALES>
    <SAMS></SAMS>
    <SIVU></SIVU>
    <SSEC></SSEC>
    <STMT>CSI outage on Sunday from 12:00am to hh:mm am/pm due to scheduled maintenance.</STMT>
    <TEEFHR></TEEFHR>
    <TEPP></TEPP>
    <TNC></TNC>
    <TODAY>Wednesday, June 15, 2011</TODAY>
    <UMZ></UMZ>
    <UMZT></UMZT>
    <UPDATE>X</UPDATE>
    <maxAutoSys>58</maxAutoSys>
    <numAutoSys>34</numAutoSys>
    <numMVS>13</numMVS>
  </Info>
</MSR>


I've submitted some of the code below that I could figure out.

I hope I explained everything the best way I can.

Thanks!
#!/opt/perl/bin/perl

use XML::Simple;

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);

my $XMLFile = "/data/MSR.xml";
my $InputFile = "/data/MSR.txt"


open (IN, "$InputFile") or die "$InputFile $!";

while (<IN>) {
    chomp($_);
    my ($xmlname, $jobname, $startdate, $starttime, $enddate, $endtime, $status, $recnum) = split(/\s+/, $_);

##### code would go here to check the time and the status
	
}	

open INPUTXML,"+<$XMLFile";
flock INPUTXML,LOCK_EX;

my $self = bless {}, "main";
my $dt = "";
$dt .= " Saturday" if $wday == 6;

my $xml = "";
{local $/; $xml .= <INPUTXML>; }
my $xml_ar = new XML::Simple->XMLin($xml);

#The code below bewteen the comments line is from the earlier EE question I mentioned before.
#It would have to be changed
 
##########################################
foreach my $tag (sort keys %sys) {
    if(ref($xml_ar->{Info}{$tag}) eq 'HASH' && scalar(keys(%{$xml_ar->{Info}{$tag}})) == 0) {
		$xml_ar->{Info}{$tag} = $sys{$tag} . '' . $dt;
    }
}
########################################


seek INPUTXML,0,0;
$_ = XMLout($xml_ar, NoAttr=>1, RootName=>'MSR',XMLDecl => 1);
s/\n/\r\n/g;
print INPUTXML;
truncate INPUTXML,tell INPUTXML;
close INPUTXML;

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
#!/usr/bin/perl

use strict;
use warnings;
use XML::Simple;
use POSIX;

my $time_limit = 60*15;
my $time       = time;
my $today      = strftime("%m/%d/%Y", localtime);
my $xml_file   = '/data/MSR.xml';
my $input_file = '/data/MSR.txt';
my $xml_ar     = XML::Simple->new->XMLin($xml_file);

open my $input_fh, '<', $input_file or die "failed to open '$input_file' $!";

while ( my $line = <$input_fh> ) {
    my ($xmlname, $jobname, $startdate, $starttime, $enddate, $endtime, $status, $recnum) = split(/\s+/, $line);
    
    #next unless $enddate = $today;
    next unless $status eq 'SU';
    
    my ($mon, $day, $yr) = split(m!/!, $enddate);
    my ($hr, $min, $sec) = split(/:/, $endtime);
    my $timestamp = mktime($sec, $min, $hr, $day, $mon-1, $yr-1900);
    my $delta = $time - $timestamp;
    
    if ( $delta < $time_limit ) {
        $xml_ar->{'Info'}{$xmlname} = strftime("%H:%M %p", localtime($timestamp));
    }
}
close $input_fh;

open my $xml_fh, '>', $xml_file or die "open($xml_file): $!";
XMLout($xml_ar, OutputFile => $xml_fh, NoAttr=>1, RootName=>'MSR',XMLDecl => 1);

Open in new window

Richard KreidlSoftware Developer

Author

Commented:
Very close, but it's not converting the time and you're adding a hour. i ran the script at 4:10pm.
I updated the text file to satisfy the critieria... the record in bold would have been meet the crieria:

COMP commisnsDlyCompTransLoadBox  08/05/2011  21:43:35 08/05/2011  21:48:07 IN 16690634/0    
CMHM ctmhmHistMartComplete        08/05/2011  04:37:37 08/07/2011  16:01:40 SU 16682425/1 CMHM ctmhmHistMartComplete        08/05/2011  04:37:37 08/07/2011  16:01:40 SU 16682425/1    
DISTM distdssMthCOMPDistDMCalc     07/30/2011  12:14:54 07/30/2011  14:08:27 IN 16629891/1    
DISTS distdssSemiMthCOMPDistDMCalc 08/06/2011  12:35:39 08/06/2011  12:53:37 IN 16695368/0    
ES00014 commisnsECSXenosClearRiskFile 08/06/2011  11:45:03 08/06/2011  11:45:46 IN 16695100/0    
FMI fieldrptChkRpts              08/06/2011  03:04:27 08/06/2011  03:04:41 SU 16692427/1    
GDC fieldrptDCMPGDCRptBox        08/05/2011  20:05:10 08/05/2011  20:38:25 SU 16689988/1    
ICCA commisnsDlyIncmPostCalcLoadBox 08/05/2011  20:46:20 08/05/2011  21:43:27 IN 16690255/0    
ICTM commisnsDlyFeedForICM        08/05/2011  19:00:07 08/05/2011  19:00:41 IN 16689367/0    
NITECOMM commisnsEndBatchCycleBox     08/06/2011  01:00:16 08/06/2011  05:39:16 IN 16691855/0    
ODSFHR psledgerFinalProcessingBx    08/06/2011  01:00:23 08/06/2011  03:15:06 SU 16691858/1    
PSF psfinclPymntRecBox           08/06/2011  01:30:09 08/06/2011  02:18:59 SU 16692019/1    
PSLDFHR psledgerPSLdBx               08/05/2011  23:01:20 08/06/2011  02:23:21 SU 16691195/1    
RPI ctmoperRiskProdComplete      08/05/2011  04:06:41 08/05/2011  04:06:44 SU 16681701/1    
SALES fieldrptDDMFMIODlySales      08/06/2011  02:28:14 08/06/2011  04:00:31 SU 16692334/1    
TEEFHR psfinclTEExEeUpdate          08/05/2011  02:28:39 08/05/2011  02:33:15 SU 16681955/1    
TEPP psfinclTEExStagePmt          08/05/2011  19:54:07 08/05/2011  19:56:42 SU 16689671/1    
TNC ctmoperOperMartComplete      08/05/2011  04:08:36 08/05/2011  04:08:39 SU 16681155/1    
SSEC invmtsecOStgProcBx           08/05/2011  21:51:42 08/05/2011  23:19:41 IN 16690700/0    
SIVU invstwhsDailyBox             08/06/2011  03:17:57 08/06/2011  04:10:00 SU 16692657/1  

XML file snippet result:
 <CMHM>17:01 PM</CMHM>

Added a hour, should have been like this:
<CMHM>4:01pm</CMHM>



 
Richard KreidlSoftware Developer

Author

Commented:

I must have double pasted the second record it's repeated twice in my last posting.

COMP commisnsDlyCompTransLoadBox  08/05/2011  21:43:35 08/05/2011  21:48:07 IN 16690634/0    
CMHM ctmhmHistMartComplete        08/05/2011  04:37:37 08/07/2011  16:01:40 SU 16682425/1    
DISTM distdssMthCOMPDistDMCalc     07/30/2011  12:14:54 07/30/2011  14:08:27 IN 16629891/1    
DISTS distdssSemiMthCOMPDistDMCalc 08/06/2011  12:35:39 08/06/2011  12:53:37 IN 16695368/0    
ES00014 commisnsECSXenosClearRiskFile 08/06/2011  11:45:03 08/06/2011  11:45:46 IN 16695100/0    
FMI fieldrptChkRpts              08/06/2011  03:04:27 08/06/2011  03:04:41 SU 16692427/1    
GDC fieldrptDCMPGDCRptBox        08/05/2011  20:05:10 08/05/2011  20:38:25 SU 16689988/1    
ICCA commisnsDlyIncmPostCalcLoadBox 08/05/2011  20:46:20 08/05/2011  21:43:27 IN 16690255/0    
ICTM commisnsDlyFeedForICM        08/05/2011  19:00:07 08/05/2011  19:00:41 IN 16689367/0    
NITECOMM commisnsEndBatchCycleBox     08/06/2011  01:00:16 08/06/2011  05:39:16 IN 16691855/0    
ODSFHR psledgerFinalProcessingBx    08/06/2011  01:00:23 08/06/2011  03:15:06 SU 16691858/1    
PSF psfinclPymntRecBox           08/06/2011  01:30:09 08/06/2011  02:18:59 SU 16692019/1    
PSLDFHR psledgerPSLdBx               08/05/2011  23:01:20 08/06/2011  02:23:21 SU 16691195/1    
RPI ctmoperRiskProdComplete      08/05/2011  04:06:41 08/05/2011  04:06:44 SU 16681701/1    
SALES fieldrptDDMFMIODlySales      08/06/2011  02:28:14 08/06/2011  04:00:31 SU 16692334/1    
TEEFHR psfinclTEExEeUpdate          08/05/2011  02:28:39 08/05/2011  02:33:15 SU 16681955/1    
TEPP psfinclTEExStagePmt          08/05/2011  19:54:07 08/05/2011  19:56:42 SU 16689671/1    
TNC ctmoperOperMartComplete      08/05/2011  04:08:36 08/05/2011  04:08:39 SU 16681155/1    
SSEC invmtsecOStgProcBx           08/05/2011  21:51:42 08/05/2011  23:19:41 IN 16690700/0    
SIVU invstwhsDailyBox             08/06/2011  03:17:57 08/06/2011  04:10:00 SU 16692657/1  

Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Richard KreidlSoftware Developer

Author

Commented:
Ok, I ran the script again at 16:33 with this line changed

:CMHM ctmhmHistMartComplete        08/05/2011  04:37:37 08/07/2011  16:12:40 SU 16682425/1

It updated the XML file adding an hour ,but it shouldn't have updated it at all since 16:12 is not within 15 minutes of 16:33:

<CMHM>17:12 PM</CMHM>
The 1hr discrepancy is probably due to the difference in timezone settings.  What timezone are you in?  And, do you adjust for daylight savings?

I'm currently using UTC -8 which is PDT and if I didn't adjust for daylight savings I would need to use PST or UTC -7

I reset my clock to 4:10 and changed the output to display 12hr clock instead of 24.
i.e.,:  $xml_ar->{'Info'}{$xmlname} = strftime("%I:%M %p", localtime($timestamp));

When I ran the script, it produced the correct results.
<?xml version='1.0' standalone='yes'?>
<MSR>
  <Info>
    <AutoSys></AutoSys>
    <BT30004></BT30004>
    <CICS></CICS>
    <CICST></CICST>
    <CM10009></CM10009>
    <CMHM>04:01 PM</CMHM>
    <COMP></COMP>
Richard KreidlSoftware Developer

Author

Commented:
I'm in Central time zone
Still adding an hour:
<CMHM>05:54 PM</CMHM>

Two things it needs to be in this format: and if it's a Saturday I need it to look like this:

<CMHM>4:54pm</CMHM>

And if it's a Saturday I need it to look like this:

<CMHM>4:54pm Saturday</CMHM>


I think you would need to incorporate day of the week code similar to this:

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$dt .= " Saturday" if $wday == 6;



I have not tested this updated version, but see if it does what you want.

#!/usr/bin/perl

use strict;
use warnings;
use XML::Simple;
use POSIX;

my $time_limit = 60*15;
my $time       = time;
my $today      = strftime("%m/%d/%Y", localtime);
my $xml_file   = 'MSR.xml';
my $input_file = 'MSR.txt';
my $xml_ar     = XML::Simple->new->XMLin($xml_file);

open my $input_fh, '<', $input_file or die "failed to open '$input_file' $!";

while ( my $line = <$input_fh> ) {
    my ($xmlname, $enddate, $endtime, $status) = (split(/\s+/, $line))[0,4,5,6];
    
    #next unless $enddate = $today;
    next unless $status eq 'SU';
    
    my ($mon, $day, $yr) = split(m!/!, $enddate);
    my ($hr, $min, $sec) = split(/:/, $endtime);
    my $timestamp        = mktime($sec, $min, $hr, $day, $mon-1, $yr-1900);
    my $delta            = $time - $timestamp;
    
    if ( $delta < $time_limit ) {
        my ($min, $hour, $wday) = (localtime($timestamp))[1,2,6];
        my $am_pm               = $hour > 11 ? 'pm' : 'am';
        my $time_string         = "$hour:$min $am_pm";
        
        $time_string .= ' Saturday' if $wday == 6;
        $xml_ar->{'Info'}{$xmlname} = $time_string;
        
    }
}
close $input_fh;

open my $xml_fh, '>', $xml_file or die "open($xml_file): $!";
XMLout($xml_ar, OutputFile => $xml_fh, NoAttr=>1, RootName=>'MSR',XMLDecl => 1);

Open in new window

Richard KreidlSoftware Developer

Author

Commented:
CMHM ctmhmHistMartComplete        08/05/2011  04:37:37 08/08/2011  11:08:40 SU 16682425/1    
DISTM distdssMthCOMPDistDMCalc     07/30/2011  12:14:54 07/30/2011  14:08:27 IN 16629891/1    
DISTS distdssSemiMthCOMPDistDMCalc 08/06/2011  12:35:39 08/06/2011  12:53:37 IN 16695368/0    
ES00014 commisnsECSXenosClearRiskFile 08/06/2011  11:45:03 08/06/2011  11:45:46 IN 16695100/0    
FMI fieldrptChkRpts              08/06/2011  03:04:27 08/06/2011  03:04:41 SU 16692427/1    
GDC fieldrptDCMPGDCRptBox        08/05/2011  20:05:10 08/08/2011  11:12:25 SU 16689988/1  

<CMHM>12:8pm</CMHM>
<GDC>12:12pm</GDC>

Very close it's still adding an hour and as you can see the CMHM XML element the zero is missing

It should have been:
<CMHM>12:08pm</CMHM>
Richard KreidlSoftware Developer

Author

Commented:
FishMonger, I noticed two more things that aren't working:

One it still updates the XML file if the time in the text file is older than 15 minutes of the current time. this way it would be picking up data from the previous run of the cycle.

Secondly, I noticed that if there ia already data in the XML element it over writes it. This XML file is pulled into a VB application in which the user can insert data into XML file manually if needed like comments.
So, I need this Perl script not to insert data into the XML element if  data  is already present there.

Here's an example from the earlier post:
http://www.experts-exchange.com/Programming/Languages/Scripting/Perl/Q_27218653.html

snippet of code from the post above dealing with checking if there is data already present in the XML element:

my $xml = "";
{local $/; $xml .= <INPUTXML>; }
my $xml_ar = new XML::Simple->XMLin($xml);

foreach my $tag (sort keys %sys) {
    if(ref($xml_ar->{Info}{$tag}) eq 'HASH' && scalar(keys(%{$xml_ar->{Info}{$tag}})) == 0) {
            $xml_ar->{Info}{$tag} = $sys{$tag} . '' . $dt;
    }
}

seek INPUTXML,0,0;
$_ = XMLout($xml_ar, NoAttr=>1, RootName=>'MSR',XMLDecl => 1);
s/\n/\r\n/g;
print INPUTXML;
truncate INPUTXML,tell INPUTXML;
close INPUTXML;
What is the value of your TZ environment variable?

Add this just before the $am_pm assignment.
$min = sprintf("%02d", $min);

Open in new window

Your code from the other post is more complicated than it needs to be and as such is convoluted.

Just add a check to see if $xml_ar->{'Info'}{$xmlname} already has a value and if so skip to the next line.

quote:
One it still updates the XML file if the time in the text file is older than 15 minutes of the current time.
It doesn't on any of my tests.  I'll take a closer look to see if I can spot how/why you are having that issue.
Richard KreidlSoftware Developer

Author

Commented:
Ok, now it looks good as far as having the zero displayed:
 <CMHM>13:04pm</CMHM>

But it's in standard 24 time and adding an hour.

Should have been:
 <CMHM>12:04pm</CMHM>


Here is the TZ environmnent variable:

TZ=CST6CDT
Sorry, I forgot to fix the 12/24 hr after taking out the strftime.

Add this:
$hour -= 12 if $hour > 12;

Open in new window


I need to work on other thing now but will look at why you're having the 1hr discrepancy when I can.  For now, you can get around it by manually adjusting the hour.  Add this just before the $time_string assignment.
$hour--;

Open in new window

That probably won't catch the edge cases, but might be enough for the time being.
Richard KreidlSoftware Developer

Author

Commented:
The hour value works fine now.

I did some testing scenarios on the 15 minutes criteria. It look like it updates the XML within an hour and 15 minutes instead of just 15 minutes.

Also, I'm not sure how to add a  check to see if $xml_ar->{'Info'}{$xmlname} already has a value and if so skip to the next line.





The exact test for previous assigned value would depend on the various types of data that you may be storing, but based on what you've posted, I'd say adding this after the other 'next' statement that I showed would do what you need.
next if $xml_ar->{'Info'}{$xmlname} eq 'HASH';

Open in new window

Richard KreidlSoftware Developer

Author

Commented:
I couldn't get your last posting to work, but I figured it out with the following code which works great:


f(ref($xml_ar->{Info}{$xmlname}) eq 'HASH' && scalar(keys(%{$xml_ar->{Info}{$xmlname}})) == 0) {
	   $xml_ar->{'Info'}{$xmlname} = $time_string;
        }	

Open in new window

 

I think the only other issue remaining is to not update the XML file if greater than 15 minutes ago from the current system date and time.
Richard KreidlSoftware Developer

Author

Commented:
After thinking about this project some more, if you could just have it check up to an hour back instead of 15 minutes.

I did some more testing  with different time stamps and it looks back one hour and 15 minutes.

I wasn't able to test the script after midnight to see what happens when the date changes...

  if the textfile has a time stamp of let's say 11:45pm  on 8/9/2011 and the script runs at 12:15am on 8/10/2011 it should still work...correct?

I'll try to test this scenario sometime in the next couple days.
Are you referring to the timestamp of the MSR.txt file or the timestamp in each line of the file (i.e. $enddate, $endtime)?
Richard KreidlSoftware Developer

Author

Commented:
The timestamp in each line of the file (i.e. $enddate, $endtime is what I want to check.

If the $enddate, $endtime  is longer than one hour from when the script ran then don't update.

Richard KreidlSoftware Developer

Author

Commented:
Let me explain this and maybe you'll have a better way of doing this.

We have a nightly batch cycle that starts at 6:30pm until 7:30am the next day. This runs Monday through Friday.

So, we go in to the next day once midnight hits.

Some of the batch cycles you see in the testfile finish before midnight and some afterwards.

So, my question would it be easier to check the time stamp of each line($enddate, $endtime) if it falls bewteen 6:30pm previous day and 7:30am the next day?

 If the day is more than two days ago don't update the XML file.
Sorry for the delay in responding.

Before I do additional research/testing, I need to confirm which version of Perl and POSIX you are using.

So far, I have not been able to duplicate your 1hr discrepancy issue.  If you're using older versions, then the problem may be related to a bug that has since been fixed.
Richard KreidlSoftware Developer

Author

Commented:
According to this is POSIX.3.

ysanne[/home/kre1973]4-> whereis POSIX
POSIX: /opt/perl/man/man3/POSIX.3

The Perl version I'm using is Perl 5.8.3
This should fix the 1hr discrepancy issue.

change:
my $timestamp        = mktime($sec, $min, $hr, $day, $mon-1, $yr-1900);

Open in new window

To:
my $timestamp        = mktime($sec, $min, $hr, $day, $mon-1, $yr-1900, 0, 0, -1);

Open in new window

Richard KreidlSoftware Developer

Author

Commented:
Thanks!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial