Skip to content

Commit

Permalink
Merge branch 'dev' into 1609dot2/strip-1609dot2-header-from-unsigned-…
Browse files Browse the repository at this point in the history
…messages
  • Loading branch information
dmccoystephenson committed Mar 13, 2024
2 parents e4210eb + 927ba44 commit 2101d56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,10 @@ public void testSnmpTimestampFromIso() throws ParseException {
String snmpTS = SNMP.snmpTimestampFromIso("2017-05-04T21:55:00-05:00");
assertEquals("07E1050415370000", snmpTS);
}

@Test
public void testSnmpTimestampFromIsoNanosecondFormat() throws ParseException {
String snmpTS = SNMP.snmpTimestampFromIso("2024-03-01T20:29:33.033Z");
assertEquals("07E80301141D211F", snmpTS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ public static String snmpTimestampFromIso(String isoTimestamp) throws ParseExcep
sb.append(String.format("%02X", zdt.getHour()));
sb.append(String.format("%02X", zdt.getMinute()));
sb.append(String.format("%02X", zdt.getSecond()));
sb.append(String.format("%02X", zdt.getNano()));
sb.append(String.format("%02X", zdt.getNano()).substring(0, 2));

return sb.toString();
}

Expand Down

0 comments on commit 2101d56

Please sign in to comment.