Skip to content

Commit cc0281d

Browse files
committed
addressed #17
1 parent abb09d8 commit cc0281d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Asn1Parser/Utils/DateTimeUtils.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,15 @@ static DateTime parseExactUtc(String strValue, String format) {
111111
}
112112
static DateTime extractDateTime(String strValue, Int32 msDelimiter, Int32 zoneDelimiter) {
113113
String rawString;
114-
if (msDelimiter > zoneDelimiter) {
114+
if (msDelimiter < 0 && zoneDelimiter < 0) {
115+
// Zulu time zone, no milliseconds
116+
rawString = strValue;
117+
} else if (msDelimiter < 0) {
118+
// Custom time zone, no milliseconds
115119
rawString = strValue.Substring(0, zoneDelimiter);
116-
} else if (msDelimiter < zoneDelimiter) {
117-
rawString = strValue.Substring(0, msDelimiter);
118120
} else {
119-
rawString = strValue;
121+
// Milliseconds
122+
rawString = strValue.Substring(0, msDelimiter);
120123
}
121124

122125
return rawString.Length switch {

0 commit comments

Comments
 (0)