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

Add Timestamp and Timespan to Puppet type system

    Details

    • Type: Improvement
    • 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 Timestamp describes a point in time
      • That Timespan describes a duration
      • That the max resolution of the types are nano seconds (in practice, the resolution depends on the platform)
      • That arithmetic can be performed on time values
      • That time values can be compared
      • That the types allow constraining the acceptable values
      Show
      That Timestamp describes a point in time That Timespan describes a duration That the max resolution of the types are nano seconds (in practice, the resolution depends on the platform) That arithmetic can be performed on time values That time values can be compared That the types allow constraining the acceptable values
    • Story Points:
      2
    • Sprint:
      Language 2016-08-24, Language 2016-09-07
    • Release Notes:
      New Feature
    • Release Notes Summary:
      Hide
      The type system has been extended with two types that helps working with time related values. The Timestamp type is a point in time, and the Timespan is a duration. Both support nano second resolution if available on the platform. Values can be created with the new function and multiple time formats are supported. Arithmetic and comparison operations can be performed on time values.
      Show
      The type system has been extended with two types that helps working with time related values. The Timestamp type is a point in time, and the Timespan is a duration. Both support nano second resolution if available on the platform. Values can be created with the new function and multiple time formats are supported. Arithmetic and comparison operations can be performed on time values.

      Description

      Timestamp and Timespan are very useful types to have. They should be represented in the Puppet type system. We will make design Pcore serialization so that these types can be serialized with a precise definition.

      Both are expressed in nano seconds. Timestamp is a timespan since the Epoch (i.e. 1970::01::01:00::00::000....). Both values are signed; for Timestamp a negative value is before the Epoch.

      The runtime objects for these types should respond to normal arithmetic. (Exception you cannot add or multiply two Timstamps, but all other combinations and operators work except shift).

      The default string format is ISO 8601 with ms - i.e "YYYYMMDDThh:mm:ss.sss UTC", and the default for timespan is a variation of ISO 8601 "nYnMnDTnHnMnSn.sss" where the YMDTHS may be given in lower case. The M ambiguity is resolved by, if there is only one M i lower case and no 'T' then it denotes minutes otherwise 'T' must be used and an m/M before T is months and minutes if after.

      Our default output should use lower case as that is more readable.

      We also need to add a formatting function, we could possibly extend sprintf. And we need to be able to create these types from both String and Numeric representation. The formatting is a separate ticket; that should be added when planning work on this ticket.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  john.duarte John Duarte
                  Reporter:
                  henrik.lindberg Henrik Lindberg
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: