static bool TryFormatDateTimeFormatG(DateTime value, TimeSpan offset, Span <byte> buffer, out int bytesWritten, TextEncoder encoder)
 {
     // for now it only works for invariant culture
     if (encoder.IsInvariantUtf8)
     {
         return(InvariantUtf8TimeFormatter.TryFormatG(value, offset, buffer, out bytesWritten));
     }
     else if (encoder.IsInvariantUtf16)
     {
         return(InvariantUtf16TimeFormatter.TryFormatG(value, offset, buffer, out bytesWritten));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Beispiel #2
0
        static bool TryFormatDateTimeFormatO(DateTime value, TimeSpan offset, Span <byte> buffer, out int bytesWritten, SymbolTable symbolTable)
        {
            // for now it only works for invariant culture
            if (symbolTable == SymbolTable.InvariantUtf8)
            {
                return(InvariantUtf8TimeFormatter.TryFormatO(value, offset, buffer, out bytesWritten));
            }
            else if (symbolTable == SymbolTable.InvariantUtf16)
            {
                return(InvariantUtf16TimeFormatter.TryFormatO(value, offset, buffer, out bytesWritten));
            }

            ThrowNotImplemented();
            bytesWritten = 0;
            return(false);
        }
Beispiel #3
0
 static bool TryFormatTimeSpan(TimeSpan value, char format, Span <byte> buffer, out int bytesWritten, SymbolTable symbolTable)
 {
     // for now it only works for invariant culture
     if (symbolTable == SymbolTable.InvariantUtf8)
     {
         return(InvariantUtf8TimeFormatter.TryFormat(value, format, buffer, out bytesWritten));
     }
     else if (symbolTable == SymbolTable.InvariantUtf16)
     {
         return(InvariantUtf16TimeFormatter.TryFormat(value, format, buffer, out bytesWritten));
     }
     else
     {
         throw new NotImplementedException();
     }
 }