示例#1
0
    public static (long ticks, long offset) Parse(FormatParser formatParser, string format, string value)
    {
        var formats = formatParser.ParseSpecifiers(format);
        var chunks  = Parse(formats, value);

        var(days, hours, minutes, seconds, ds, cs, ms, tts, hts, micros, tick, pm) =
            (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false);
        var(year, month) = (0, 0);
        var offset = 0L;
        var negate = false;

        foreach (var(kind, val) in chunks)
        {
            switch (kind)
            {
            case Sign:
                negate = val == "-";
                break;

            case Offset:
            {
                if (val.Length == 0)
                {
                    throw new FormatException();
                }

                var sign = val[0];
                var sval = val[1..];