Search code examples
snmpmib

Difference between TimeTicks and TimeInterval SMI types


RFC 2578 "Structure of Management Information Version 2 (SMIv2)" contains a type TimeTicks which is defined as IMPLICIT INTEGER (0..4294967295) and described as "non-negative integer which represents the time, modulo 2^32 (4294967296 decimal), in hundredths of a second between two epochs".

RFC 2579 "Textual Conventions for SMIv2" contains a type TimeInterval which is defined as TEXTUAL-CONVENTION with SYNTAX INTEGER (0..2147483647) and described as "A period of time, measured in units of 0.01 seconds.".

I fail to see differences between these two things, or in other words why would TimeInterval be needed (except maybe for historical reasons) when there is TimeTicks. If there are practical differences, what are they and what types should I use?


Solution

  • I believe TimeTicks is meant to represent a point in time by referencing two known epochs, whereas TimeInterval represents period of time with no reference.

    In the case of TimeTicks, note the last sentence of the definition:

    The TimeTicks type represents a non-negative integer which represents the time, modulo 2^32 (4294967296 decimal), in hundredths of a second between two epochs. When objects are defined which use this ASN.1 type, the description of the object identifies both of the reference epochs.

    The next paragraph describes how TimeStamp defines these two epochs:

    For example, [3] defines the TimeStamp textual convention which is based on the TimeTicks type. With a TimeStamp, the first reference epoch is defined as the time when sysUpTime [5] was zero, and the second reference epoch is defined as the current value of sysUpTime.

    TimeInterval is not meant to be used to count time, rather to define a length of time. Take a look at this object from CISCO that uses TimeInterval:

    snmpTargetAddrTimeout OBJECT-TYPE
           SYNTAX      TimeInterval
           MAX-ACCESS  read-create
           STATUS      current
           DESCRIPTION           "This object should reflect the expected maximum round
                trip time for communicating with the transport address
                defined by this row.  When a message is sent to this
                address, and a response (if one is expected) is not
                received within this time period, an implementation
                may assume that the response will not be delivered.
                Note that the time interval that an application waits
                for a response may actually be derived from the value
                of this object.  The method for deriving the actual time
                interval is implementation dependent.  One such method
                is to derive the expected round trip time based on a
                particular retransmission algorithm and on the number
                of timeouts which have occurred.  The type of message may
                also be considered when deriving expected round trip
                times for retransmissions.  For example, if a message is
                being sent with a securityLevel that indicates both
                authentication and privacy, the derived value may be
                increased to compensate for extra processing time spent
                during authentication and encryption processing.
    "
           DEFVAL { 1500 }
           ::= { snmpTargetAddrEntry 4 }