File: timestamp.t

package info (click to toggle)
libtime-piece-mysql-perl 0.06-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 80 kB
  • sloc: perl: 117; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 638 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl
use strict;
use Test::More;
use Time::Piece::MySQL;

my %timestamp = (
    '70' => '19700101000000',
    '1202' => '20120201000000',
    '120211' => '20120211000000',
    '20120211' => '20120211000000',
    '1202110545' => '20120211054500',
    '120211054537' => '20120211054537',
    '20120211054537' => '20120211054537',
    '2005-08-10 23:20:48' => '20050810232048',
);

#my @null = qw/ 19691231235959 20380101000000 /;

plan tests => scalar keys %timestamp;

for my $stamp (keys %timestamp) {
    my $t = Time::Piece->from_mysql_timestamp($stamp);
    is $t->mysql_timestamp, $timestamp{$stamp}, "timestamp $stamp";
}