I can barely read XS, so I don't know whether this is a bug in
Wx::DateTime or the underlying wxDateTime.

Consider the following short program:

# BEGIN----------------------------
use Wx::DateTime;
print "Wx version is $Wx::VERSION\nwxWidgets version is
$Wx::wxVERSION_STRING\n\n";

my $dt = Wx::DateTime->new;
$dt->Set(30, 7, 2010,   1, 23, 45, 0);
dumpdt($dt);

$dt->SetYear(2009);
$dt->SetMonth(5);
$dt->SetDay(15);
$dt->SetHour(13);
$dt->SetMinute(24);
$dt->SetSecond(57);
$dt->SetMillisecond(680);
dumpdt($dt);

sub dumpdt
{
    my $d = shift;
    printf "%04d/%02d/%02d %02d:%02d:%02d.%03d\n",
        $d->GetYear, $d->GetMonth+1, $d->GetDay,
        $d->GetHour, $d->GetMinute, $d->GetSecond, $d->GetMillisecond;
    print $d->FormatISODate, ' ', $d->FormatISOTime, "\n\n";
}
# END-------------------------------

On my computer, this produces the following output:

    Wx version is 0.98
    wxWidgets version is wxWidgets 2.8.10

    2010/08/30 01:23:13.558
    2010-08-30 01:23:13

    2009/06/15 13:24:57.680
    2009-06-15 13:24:57

As you can see, the Set() method does not properly set the Seconds
or Millseconds attribute.  Also, it seems to be doing something naughty in
memory, because when another (larger) program calls Set(), it later crashes;
if I change the code to set the attributes individually, it does not crash.


-- 
Eric J. Roode

Reply via email to