Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateAndTime - Hex to Timestamp conversion #691

Closed
PolovicJ opened this issue Apr 10, 2024 · 1 comment · Fixed by #696
Closed

DateAndTime - Hex to Timestamp conversion #691

PolovicJ opened this issue Apr 10, 2024 · 1 comment · Fixed by #696
Labels
enhancement New feature or request

Comments

@PolovicJ
Copy link

Some OIDs represent timestamp values in DateandTime format as documented in the SNMPv2-TC MIB.

DateAndTime ::= TEXTUAL-CONVENTION
    DISPLAY-HINT "2d-1d-1d,1d:1d:1d.1d,1a1d:1d"
    STATUS       current
    DESCRIPTION
            "A date-time specification.

            field  octets  contents                  range
            -----  ------  --------                  -----
              1      1-2   year*                     0..65536
              2       3    month                     1..12
              3       4    day                       1..31
              4       5    hour                      0..23
              5       6    minutes                   0..59
              6       7    seconds                   0..60
                           (use 60 for leap-second)
              7       8    deci-seconds              0..9
              8       9    direction from UTC        '+' / '-'
              9      10    hours from UTC*           0..13
             10      11    minutes from UTC          0..59

            * Notes:
            - the value of year is in network-byte order
            - daylight saving time in New Zealand is +13

            For example, Tuesday May 26, 1992 at 1:30:15 PM EDT would be
            displayed as:

                             1992-5-26,13:30:15.0,-4:0

            Note that if only local time is known, then timezone
            information (fields 8-10) is not present."
    SYNTAX       OCTET STRING (SIZE (8 | 11))

E.g. spsActiveAlarmLogTime for SilverPeak SD-WAN devices:
iso.3.6.1.4.1.23867.3.1.1.2.1.1.11.1 = Hex-STRING: 07 E7 0A 1C 15 35 34 00 2B 00 00

Using the conversion above the timestamp value would be converted to:
2023-10-28,21:53:52.0,+0:0

Does ktranslate provide a conversion function for DateAndTime format?
I couldn't find anything in the documentation except hextoip and hextoint function.
I tested the latter but it does not provide a correct output.

@i3149 i3149 added the enhancement New feature or request label Apr 12, 2024
@i3149
Copy link
Contributor

i3149 commented Apr 12, 2024

Not yet but should be possible to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants