Esempio n. 1
0
        private void parseTime()
        {
            int hour = _value;

            _value = NULL_VALUE;
            if (hour < 0)
            {
                hour = -hour;
            }

            _date.setHour(hour);
            _date.setMinute(0);
            _date.setSecond(0);
            _date.setMillisecond(0);

            int token = nextToken();

            if (token == INT)
            {
                _date.setMinute(_value);
                _value = NULL_VALUE;
            }
            else
            {
                _peekToken = token;
                return;
            }

            token = nextToken();

            if (token == ':')
            {
                token = nextToken();

                if (token == INT)
                {
                    _date.setSecond(_value);
                    _value = NULL_VALUE;
                }
                else
                {
                    _peekToken = token;
                    return;
                }

                token = nextToken();

                if (token == '.') // milliseconds
                {
                    token = nextToken();

                    if (token == INT)
                    {
                        token = nextToken();
                    }
                    else
                    {
                        _peekToken = token;
                        //_value = NULL_VALUE;

                        return;
                    }
                }
            }

            if (token == AM)
            {
                hour = _date.getHour();

                if (hour == 12)
                {
                    _date.setHour(0);
                }
            }
            else if (token == PM)
            {
                hour = _date.getHour();

                if (hour == 12)
                {
                    _date.setHour(12);
                }
                else
                {
                    _date.setHour(hour + 12);
                }
            }
            else
            {
                _peekToken = token;
            }

            parseTimezone();
        }