#!/usr/bin/perl -w

# This test script runs by hand and shows the difference between
# SetDate and ForceDate options.

use Date::Manip;

$date = new Date::Manip::Date;
$dmb  = $$date{"objs"}{"base"};

sub _print {
   my($label,$date) = @_;
   my $d   = $date->value();
   my ($z) = $dmb->_now("tz");

   print $label," "x(40-length($label)),"$d $z\n";
}

# SetDate

print "There will be a 5 second pause between inputs...\n\n";

$date->config("SetDate","now,America/New_York");

$date->parse("now");
_print("SetDate=now,America/New_York",$date);

sleep 5;

$date->parse("now");
_print("+ 5 seconds",$date);

print "\n";

$date->config("SetDate","zone,America/Chicago");

$date->parse("now");
_print("SetDate=zone,America/Chicago",$date);

sleep 5;

$date->parse("now");
_print("+ 5 seconds",$date);

print "\n";

$date->config("SetDate","2000-01-01-12:00:00");

$date->parse("now");
_print("SetDate=2000-01-01-12:00:00",$date);

sleep 5;

$date->parse("now");
_print("+ 5 seconds",$date);

print "\n";

$date->config("SetDate","2000-01-01-12:00:00,America/Denver");

$date->parse("now");
_print("SetDate=2000-01-01-12:00:00,Denver",$date);

sleep 5;

$date->parse("now");
_print("+ 5 seconds",$date);

print "\n";

# ForceDate

$date->config("ForceDate","now,America/New_York");

$date->parse("now");
_print("ForceDate=now,America/New_York",$date);

sleep 5;

$date->parse("now");
_print("+ 5 seconds",$date);

print "\n";

$date->config("ForceDate","zone,America/Chicago");

$date->parse("now");
_print("ForceDate=zone,America/Chicago",$date);

sleep 5;

$date->parse("now");
_print("+ 5 seconds",$date);

print "\n";

$date->config("ForceDate","2000-01-01-12:00:00");

$date->parse("now");
_print("ForceDate=2000-01-01-12:00:00",$date);

sleep 5;

$date->parse("now");
_print("+ 5 seconds",$date);

print "\n";

$date->config("ForceDate","2000-01-01-12:00:00,America/Denver");

$date->parse("now");
_print("ForceDate=2000-01-01-12:00:00,Denver",$date);

sleep 5;

$date->parse("now");
_print("+ 5 seconds",$date);

print "\n";

# Local Variables:
# mode: cperl
# indent-tabs-mode: nil
# cperl-indent-level: 3
# cperl-continued-statement-offset: 2
# cperl-continued-brace-offset: 0
# cperl-brace-offset: 0
# cperl-brace-imaginary-offset: 0
# cperl-label-offset: 0
# End:
