Subject: | Weird DateTime behaviour |
Hi there
I'm not sure this is a bug or not, but it sure looks like one (or I'm
seriously misunderstanding how I should use this).
I am using Mac::Glue 1.27 (but that is not in the "Broken in" list...
Perl v5.8.6
EyeTV 2.3.2
Mac OS X 10.4.7
Basically I send a DateTime object to EyeTV, eg 1163109600. It
correctly converts this to 2006-11-07 22:10. However, when I ask for
that value back, I get 30308468150 ?! I can not understand what went
wrong there...
I have pasted some sample code below... if this is not a defect but I'm
doing something wrong, I'd love to know what... currently I can't get my
script to work cuz it thinks all my recordings are from the seventies :-(
/Cheers,
Jelte
#!/usr/bin/perl -w
use strict;
use warnings;
use DateTime;
use Mac::Glue;
my $start = DateTime->new( year => 2006,
month => 11,
day => 9,
hour => 22,
minute => 00,
second => 00,
nanosecond => 000000000,
time_zone => 'floating',
);
my $stop = DateTime->new( year => 2006,
month => 11,
day => 9,
hour => 23,
minute => 10,
second => 00,
nanosecond => 000000000,
time_zone => 'floating',
);
my $title = "foobar";
my $description = "";
my $channel_number = 5;
my $duration = ($stop->epoch - $start->epoch);
my $eyetv = Mac::Glue->new('EyeTV');
$eyetv->make(
new => 'program',
with_properties => {
'start time' => $start->epoch,
duration => $duration,
title => $title,
description => $description,
'channel number' => $channel_number,
},
);
print $start->epoch . "\n";
my @eyetv_programmes = $eyetv->obj('programs')->get;
print $eyetv_programmes[0]->prop("start time")->get . "\n";