Re: [Veritas-bu] Need date calculation utility
2007-12-20 19:28:07
Why not store the final expiration date in the media's comment field ?
- John Nardello
-----Original Message-----
From: veritas-bu-bounces AT mailman.eng.auburn DOT edu
[mailto:veritas-bu-bounces AT mailman.eng.auburn DOT edu] On Behalf Of Conner,
Neil
Sent: Thursday, December 20, 2007 3:39 PM
To: A Darren Dunham; veritas-bu AT mailman.eng.auburn DOT edu
Subject: Re: [Veritas-bu] Need date calculation utility
It's a little more complicated than that. My retention periods are 2
and 5 years. Media going offsite for the first time are not a problem.
The problem I have is with media that have been called back from offsite
prior to their return date. I've been storing my offsite details in the
volume database with vmchange (-vltsent, -vltreturn), but as soon as I
load a tape in the robot, its return date is reset to 00/00/0000 (is
this configurable?) so I have to recalculate it based on the expiration
date.
I suppose I could use your code example and work backwards to normalize
the expiration date to a service date week and then work forward from
there.
Or I could maintain an inventory of media and return dates outside of
the volume database.
Any other ideas?
-----Original Message-----
From: veritas-bu-bounces AT mailman.eng.auburn DOT edu
[mailto:veritas-bu-bounces AT mailman.eng.auburn DOT edu] On Behalf Of A Darren
Dunham
Sent: Thursday, December 20, 2007 2:28 PM
To: veritas-bu AT mailman.eng.auburn DOT edu
Subject: Re: [Veritas-bu] Need date calculation utility
On Thu, Dec 20, 2007 at 11:56:44AM -0800, Conner, Neil wrote:
> I recently switched my offsite schedule to an every-other Tuesday
> schedule and I'm having difficulty calculating a valid return date for
> that scenario.
Is this frequency based? Is it possible that the schedule could slip by
a week at some point in the future so that you're on the alternate set
of days?
> How do I know if any given Tuesday in the future falls on a service
> date or not? I'm running Solaris and I have the Date-Calc package by
> Steffen Beyer, but I haven't found an example of how to solve this
> particular problem and I haven't learned perl well enough yet to
> figure it out on my own - has anybody solved a problem like this?
There's lots of ways. You could ask for every Tuesday in the future and
then just throw away half of them.
You could give it a start date and then just add 14 days to find future
ones.
Or for your specific question (is a given day in the schedule), you
could subtract the difference in days and find out if it's a multiple of
14.
Here's a sample using Date::Calc :
#!/usr/bin/perl
use strict;
use warnings;
use Date::Calc;
my @start_date = (2007,12,20);
my @date = @start_date;
printf "Start date: %4u-%02u-%02u\n", @date;
my $iterations = 10;
print "The next $iterations 2 week date:\n";
for (1 .. $iterations)
{
@date = Date::Calc::Add_Delta_Days(@date, 14);
printf "Iteration %u: %4u-%02u-%02u\n", $_, @date;
}
print "\nDoes a given date fall on the 2 week schedule or not?\n";
foreach my $date_ref ([2009,6,17], [2009,6,18])
{
@date = @{$date_ref};
my $mod_difference = Date::Calc::Delta_Days(@start_date, @date) % 14;
printf "Date %4u-%02u-%02u has a modular difference of %u. ",
(@date, $mod_difference);
print $mod_difference ? "not on schedule.\n" : "on schedule.\n";
}
--
Darren Dunham ddunham AT taos DOT com
Senior Technical Consultant TAOS http://www.taos.com/
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >
_______________________________________________
Veritas-bu maillist - Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
_______________________________________________
Veritas-bu maillist - Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
_______________________________________________
Veritas-bu maillist - Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
|
|
|