Re: [mythtv-users] mythfilldatabase: Ignoring unknown timestamp format: 20161231235960

Kevin Groeneveld <[email protected]> Tue, 20 Dec 2016 20:25:23 -0500
Newsgroups gmane.comp.tv.xmltv.devel
Message-ID <CABF+-6UZetYZuccRp6+Qz1NAutFGW7TMN4+E-3eZ8H9+tk1W1w@mail.gmail.com>
On Tue, Dec 20, 2016 at 11:12 AM, Robert Eden <[email protected]> wrote:

> It's interesting that your time APIs seem to be aware of the upcoming
> leap second.  I didn't test with perl DateTime, but I did try PHP... I
> expected both used the OS API and didn't seem to know about the leap
> second.
>

On Ubuntu 14.04 the following perl code:

use DateTime;

my $dt = DateTime->new(
    year       => 2008,
    month      => 12,
    day        => 31,
    hour       => 23,
    minute     => 0,
    second     => 0,
    time_zone  => 'UTC',
);

my $dur = DateTime::Duration->new(
    seconds => 3600,
);

print $dt->strftime('%Y%m%d%H%M%S %z'), "\n";
$dt->add_duration($dur);
print $dt->strftime('%Y%m%d%H%M%S %z'), "\n";

Produces the result:
20081231230000 +0000
20081231235960 +0000

So, as the documentation indicates, DateTime can account for leap seconds.
However if I change the 2008 to 2016 in the above code the leap second is
not recognized.  I suspect a newer version of Ubuntu or DateTime would fix
this. This probably explains why I never saw the same results Ian was
reporting even with the older tv_grab_sd_json code which used DateTime.  I
am a little surprised that a still in support LTS version of Ubuntu doesn't
seem to recognize the leap second that is happening in a few days.


Kevin

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel

_______________________________________________
xmltv-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmltv-devel