#5045 clock scan does not error when missing undelimited fields

obsolete: 8.5.11
pending-duplicate
5
2012-06-01
2012-05-31
Jeff Lawson
No

In the following example, the first string being parsed is missing the seconds needed for the %S parameter, so it chooses to put one of the digits in the minutes field and one of them in the seconds field instead:

clock scan "1205311743" -format "%y%m%d%H%M%S" -gmt 1
1338483843

clock format 1338483843 -gmt 1
Thu May 31 17:04:03 GMT 2012

The expected behavior would probably to treat the missing seconds as zero, or to raise an error:

clock scan "120531174300" -format "%y%m%d%H%M%S" -gmt 1
1338486180

Discussion

  • Jeff Lawson

    Jeff Lawson - 2012-05-31

    Note that the documentation for clock says that both %M and %S only accept 2 digits on input (and not 1 or 2 digits).

     
  • Serg G. Brester

    Serg G. Brester - 2012-06-01

    duplicate of 3475995 (already solved - see attached patch in it, but not yet in branch).

     
  • Serg G. Brester

    Serg G. Brester - 2012-06-01
    • status: open --> pending-duplicate
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks