Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-6686

Timespan sometimes parses fractions incorrectly.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.8.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Acceptance Criteria:
      Hide

      That applying:

      notice(strftime(Timespan('02:03.4', '%M:%S.%L'), '%M:%S.%-L'))
      

      notices

      02:03.4
      

      and applying:

      notice(strftime(Timespan('02:03.0456', '%M:%S.%N'), '%M:%S.%-N'))
      

      notices

      02:03.0456
      

      Show
      That applying: notice(strftime(Timespan( '02:03.4' , '%M:%S.%L' ), '%M:%S.%-L' )) notices 02:03.4 and applying: notice(strftime(Timespan( '02:03.0456' , '%M:%S.%N' ), '%M:%S.%-N' )) notices 02:03.0456
    • Team:
      Puppet Developer Experience
    • Story Points:
      1
    • Sprint:
      Language 2016-09-07, PDS 2016-09-21, PDS 2016-10-05
    • Release Notes:
      Not Needed
    • Release Notes Summary:
      Part of adding support for Timespan and Timestamp

      Description

      The following code, when applied,

       
      notice(strftime(Timespan('02:03.4', '%M:%S.%L'), '%M:%S.%L')) 
      

      incorrectly notices

       
      02:03.004 
      

      The reason is that the '4' is parsed by the '%L' format descriptor, and hence considered to be milliseconds. While this is correct in some sense, it's not very intuitive. Puppet should instead do what Ruby's DateTime#strptime does and treat %L and %N as values to the right of a decimal point, i.e. a "4" is intepreted as "0.4", which means 400000000 nanoseconds.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  thomas.hallgren Thomas Hallgren
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Zendesk Support