Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ WriteGeneralizedTimeCore()

void System.Formats.Asn1.AsnWriter.WriteGeneralizedTimeCore ( Asn1Tag tag,
DateTimeOffset value,
bool omitFractionalSeconds )
inlineprivate

Definition at line 619 of file AsnWriter.cs.

620 {
621 DateTimeOffset dateTimeOffset = value.ToUniversalTime();
622 if (dateTimeOffset.Year > 9999)
623 {
624 throw new ArgumentOutOfRangeException("value");
625 }
628 {
629 long num = dateTimeOffset.Ticks % 10000000;
630 if (num != 0L)
631 {
632 destination = stackalloc byte[9];
633 decimal value2 = num;
634 value2 /= 10000000m;
636 {
637 throw new InvalidOperationException();
638 }
639 destination = destination.Slice(1, bytesWritten - 1);
640 }
641 }
642 int length = 15 + destination.Length;
643 WriteTag(tag);
645 int year = dateTimeOffset.Year;
646 int month = dateTimeOffset.Month;
647 int day = dateTimeOffset.Day;
648 int hour = dateTimeOffset.Hour;
649 int minute = dateTimeOffset.Minute;
650 int second = dateTimeOffset.Second;
651 Span<byte> span = _buffer.AsSpan(_offset);
655 {
656 throw new InvalidOperationException();
657 }
658 _offset += 14;
659 destination.CopyTo(span.Slice(14));
660 _offset += destination.Length;
661 _buffer[_offset] = 90;
662 _offset++;
663 }
static bool TryFormat(bool value, Span< byte > destination, out int bytesWritten, StandardFormat format=default(StandardFormat))
void WriteLength(int length)
Definition AsnWriter.cs:272
void WriteTag(Asn1Tag tag)
Definition AsnWriter.cs:261

References System.Formats.Asn1.AsnWriter._buffer, System.Formats.Asn1.AsnWriter._offset, System.destination, System.format, System.L, System.length, System.Buffers.Text.Utf8Formatter.TryFormat(), System.value, System.Formats.Asn1.AsnWriter.WriteLength(), System.Formats.Asn1.AsnWriter.WriteTag(), and System.year.

Referenced by System.Formats.Asn1.AsnWriter.WriteGeneralizedTime().