IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8940


Ignore:
Timestamp:
Sep 25, 2006, 11:49:42 AM (20 years ago)
Author:
jhoblitt
Message:

add fractional second support to the ISO8601 format

Location:
trunk/PS-IPP-Metadata-Config
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-Metadata-Config/config_grammar.txt

    r8888 r8940  
    11# Copyright (c) 2005  Joshua Hoblitt
    22#
    3 # $Id: config_grammar.txt,v 1.2 2006-09-23 00:26:50 jhoblitt Exp $
     3# $Id: config_grammar.txt,v 1.3 2006-09-25 21:49:42 jhoblitt Exp $
    44
    55{
     
    348348iso8601:
    349349    # based on code from DateTime::Format::ISO8601
    350     / (\d{4}) - (\d\d) - (\d\d) T (\d\d) : (\d\d) : (\d\d) Z /x
     350    / \d{4} -?? \d\d -?? \d\d T?? \d\d :?? \d\d :?? \d\d (?:[\.,] (\d+))? Z/x
    351351        { DateTime::Format::ISO8601->parse_datetime( $item[1] ) }
    352352
  • trunk/PS-IPP-Metadata-Config/t/05_time.t

    r3655 r8940  
    33# Copyright (C) 2005  Joshua Hoblitt
    44#
    5 # $Id: 05_time.t,v 1.2 2005-04-05 00:16:41 jhoblitt Exp $
     5# $Id: 05_time.t,v 1.3 2006-09-25 21:49:42 jhoblitt Exp $
    66
    77use strict;
     
    1212#$::RD_TRACE = 1;
    1313
    14 use Test::More tests => 8;
     14use Test::More tests => 10;
    1515use PS::IPP::Metadata::Config;
    1616
     
    3030{
    3131my $example =<<END;
     32recently    UTC     2005-03-18T16:05:00.000001Z
     33recently    UT1     2005-03-18T16:05:00.000001Z
     34recently    TAI     2005-03-18T16:05:00.000001Z
     35recently    TT      2005-03-18T16:05:00.000001Z
     36END
     37    my $config = $config_parser->parse( $example );
     38    ok( defined( $config ), "basic IS8601 with fractional seconds");
     39}
     40
     41{
     42my $example =<<END;
    3243recently    UTC     2005-03-18T16:05:00Z    # foo
    3344recently    UT1     2005-03-18T16:05:00Z    # bar
     
    3748    my $config = $config_parser->parse( $example );
    3849    ok( defined( $config ), "ISO8601 with comments");
     50}
     51
     52{
     53my $example =<<END;
     54recently    UTC     2005-03-18T16:05:00.000001Z    # foo
     55recently    UT1     2005-03-18T16:05:00.000001Z    # bar
     56recently    TAI     2005-03-18T16:05:00.000001Z    # baz
     57recently    TT      2005-03-18T16:05:00.000001Z    #
     58END
     59    my $config = $config_parser->parse( $example );
     60    ok( defined( $config ), "ISO8601 with comments and fractional seconds");
    3961}
    4062
Note: See TracChangeset for help on using the changeset viewer.