1082 {
1083 char c = FormattingHelpers.GetSymbolOrDefault(in
format,
'c');
1084 switch (c)
1085 {
1086 case 'T':
1087 case 't':
1088 c = 'c';
1089 break;
1090 default:
1091 return FormattingHelpers.TryFormatThrowFormatException(out bytesWritten);
1092 case 'G':
1093 case 'c':
1094 case 'g':
1095 break;
1096 }
1097 int num = 8;
1098 long ticks =
value.Ticks;
1099 uint valueWithoutTrailingZeros;
1100 ulong num2;
1101 if (ticks < 0)
1102 {
1103 ticks = -ticks;
1104 if (ticks < 0)
1105 {
1106 valueWithoutTrailingZeros = 4775808u;
1107 num2 = 922337203685uL;
1108 goto IL_008d;
1109 }
1110 }
1111 (ulong Quotient, ulong Remainder) tuple = Math.DivRem((ulong)Math.Abs(
value.Ticks), 10000000uL);
1112 num2 = tuple.Quotient;
1113 ulong
item = tuple.Remainder;
1114 valueWithoutTrailingZeros = (uint)
item;
1115 goto IL_008d;
1116 IL_008d:
1117 int num3 = 0;
1118 switch (c)
1119 {
1120 case 'c':
1121 if (valueWithoutTrailingZeros != 0)
1122 {
1123 num3 = 7;
1124 }
1125 break;
1126 case 'G':
1127 num3 = 7;
1128 break;
1129 default:
1130 if (valueWithoutTrailingZeros != 0)
1131 {
1132 num3 = 7 - FormattingHelpers.CountDecimalTrailingZeros(valueWithoutTrailingZeros, out valueWithoutTrailingZeros);
1133 }
1134 break;
1135 }
1136 if (num3 != 0)
1137 {
1138 num += num3 + 1;
1139 }
1140 ulong num4 = 0uL;
1141 ulong num5 = 0uL;
1142 if (num2 != 0)
1143 {
1144 (num4, num5) = Math.DivRem(num2, 60uL);
1145 }
1146 ulong num6 = 0uL;
1147 ulong num7 = 0uL;
1148 if (num4 != 0)
1149 {
1150 (num6, num7) = Math.DivRem(num4, 60uL);
1151 }
1152 uint num8 = 0u;
1153 uint num9 = 0u;
1154 if (num6 != 0)
1155 {
1156 (num8, num9) = Math.DivRem((uint)num6, 24u);
1157 }
1158 int num10 = 2;
1159 if (num9 < 10 && c == 'g')
1160 {
1161 num10--;
1162 num--;
1163 }
1164 int num11 = 0;
1165 if (num8 == 0)
1166 {
1167 if (c == 'G')
1168 {
1169 num += 2;
1170 num11 = 1;
1171 }
1172 }
1173 else
1174 {
1175 num11 = FormattingHelpers.CountDigits(num8);
1176 num += num11 + 1;
1177 }
1178 if (
value.Ticks < 0)
1179 {
1180 num++;
1181 }
1183 {
1184 bytesWritten = 0;
1185 return false;
1186 }
1187 bytesWritten = num;
1188 int num12 = 0;
1189 if (
value.Ticks < 0)
1190 {
1192 }
1193 if (num11 > 0)
1194 {
1195 FormattingHelpers.WriteDigits(num8,
destination.Slice(num12, num11));
1196 num12 += num11;
1197 destination[num12++] = (byte)((c ==
'c') ? 46 : 58);
1198 }
1199 FormattingHelpers.WriteDigits(num9,
destination.Slice(num12, num10));
1200 num12 += num10;
1202 FormattingHelpers.WriteDigits((uint)num7,
destination.Slice(num12, 2));
1203 num12 += 2;
1205 FormattingHelpers.WriteDigits((uint)num5,
destination.Slice(num12, 2));
1206 num12 += 2;
1207 if (num3 > 0)
1208 {
1210 FormattingHelpers.WriteDigits(valueWithoutTrailingZeros,
destination.Slice(num12, num3));
1211 num12 += num3;
1212 }
1213 return true;
1214 }