diff --git a/mythtv/bindings/perl/Makefile.PL b/mythtv/bindings/perl/Makefile.PL
index d072d29..49c4930 100644
|
a
|
b
|
WriteMakefile(
|
| 18 | 18 | 'Config' => 0, |
| 19 | 19 | 'DBI' => 0, |
| 20 | 20 | 'DBD::mysql' => 0, |
| 21 | | 'Date::Manip' => 0, |
| 22 | 21 | 'Fcntl' => 0, |
| 23 | 22 | 'File::Copy' => 0, |
| 24 | 23 | 'HTTP::Request' => 0, |
diff --git a/mythtv/bindings/perl/MythTV.pm b/mythtv/bindings/perl/MythTV.pm
index cb0d055..fae7b77 100644
|
a
|
b
|
package MythTV;
|
| 23 | 23 | use DBI; |
| 24 | 24 | use HTTP::Request; |
| 25 | 25 | use LWP::UserAgent; |
| 26 | | use Time::Local; |
| | 26 | use POSIX; |
| 27 | 27 | |
| 28 | 28 | # Load the UPNP libraries if we have them, but die nicely if we don't. |
| 29 | 29 | BEGIN { |
| … |
… |
EOF
|
| 372 | 372 | $self->{'db_user'}, |
| 373 | 373 | $self->{'db_pass'}) |
| 374 | 374 | or die "Cannot connect to database: $!\n\n"; |
| | 375 | $self->{'dbh'}->do("SET time_zone = 'UTC'") |
| | 376 | or die "Can't set timezone: $!\n\n"; |
| 375 | 377 | |
| 376 | 378 | # Check for supported schema version |
| 377 | 379 | $self->{'schema_version'} = $self->backend_setting('DBSchemaVer'); |
| … |
… |
EOF
|
| 798 | 800 | if ($time =~ /^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/) { |
| 799 | 801 | return "$1-$2-${3}T$4:$5:$6"; |
| 800 | 802 | } |
| 801 | | # Otherwise, format it as necessary. We have to use MySQL here because |
| 802 | | # Date::Manip is not aware of DST differences. Yay. Blech. |
| 803 | | my $sh = $self->{'dbh'}->prepare('SELECT FROM_UNIXTIME(?)'); |
| 804 | | $sh->execute($time); # Assumed to be a correct epoch time (in GMT) |
| 805 | | ($time) = $sh->fetchrow_array(); |
| 806 | | $time =~ s/\s/T/; |
| 807 | | return $time; |
| | 803 | # Otherwise, format it as necessary. |
| | 804 | return POSIX::strftime("%Y-%m-%dT%H:%M:%S", gmtime($time)); |
| 808 | 805 | } |
| 809 | 806 | |
| 810 | 807 | # Format a MythTV timestamp into a unix timestamp. This function is exported. |
| 811 | | # We have to use MySQL here because Date::Manip is not aware of DST. |
| | 808 | # We have to use MySQL here because it was used historically, and so the |
| | 809 | # formats that MySQL supports is effectively the API... |
| 812 | 810 | sub myth_to_unix_time { |
| 813 | 811 | my $self = (ref $_[0] ? shift : $MythTV::last); |
| 814 | 812 | my $time = shift; |
| 815 | 813 | my $sh = $self->{'dbh'}->prepare('SELECT UNIX_TIMESTAMP(?)'); |
| 816 | 814 | $sh->execute($time); |
| 817 | 815 | ($time) = $sh->fetchrow_array(); |
| 818 | | my @t = localtime(time); |
| 819 | | my $offset = timegm(@t) - timelocal(@t); |
| 820 | | return $time - $offset; |
| | 816 | return $time; |
| 821 | 817 | } |
| 822 | 818 | |
| 823 | 819 | # Create a new MythTV::Program object |