Processes this time entry

If the time is not valid an error message is attached to this time
entry.
555642
public function process()
    {
        parent::process();

        if (!$this->isVisible()) {
            return;
        }

        $hour = 0;
        $minute = 0;
        $second = 0;

        $all_empty = true;
        $any_empty = false;

        if ($this->display_parts & self::HOUR) {
            $hour_flydown = $this->getCompositeWidget('hour_flydown');
            $hour = $hour_flydown->value;
            if ($hour === null) {
                if ($this->required_parts & self::HOUR) {
                    $any_empty = true;
                } else {
                    $hour = 0;
                }
            } else {
                $all_empty = false;
            }

            if ($this->twelve_hour) {
                $am_pm_flydown = $this->getCompositeWidget('am_pm_flydown');
                $am_pm = $am_pm_flydown->value;
                if ($am_pm === null) {
                    if ($this->required_parts & self::HOUR) {
                        $any_empty = true;
                    } else {
                        $am_pm = 'am';
                    }
                } else {
                    $all_empty = false;
                }

                // convert 12-hour display to 24-hour value
                if ($hour !== null && $am_pm == 'pm' && $hour != 12) {
                    $hour += 12;
                }
                if ($hour == 12 && $am_pm == 'am') {
                    $hour = 0;
                }
            }
        }

        if ($this->display_parts & self::MINUTE) {
            $minute_flydown = $this->getCompositeWidget('minute_flydown');
            $minute = $minute_flydown->value;
            if ($minute === null) {
                if ($this->required_parts & self::MINUTE) {
                    $any_empty = true;
                } else {
                    $minute = 0;
                }
            } else {
                $all_empty = false;
            }
        }

        if ($this->display_parts & self::SECOND) {
            $second_flydown = $this->getCompositeWidget('second_flydown');
            $second = $second_flydown->value;
            if ($second === null) {
                if ($this->required_parts & self::SECOND) {
                    $any_empty = true;
                } else {
                    $second = 0;
                }
            } else {
                $all_empty = false;
            }
        }

        if ($all_empty) {
            if ($this->required && $this->isSensitive()) {
                if ($this->show_field_title_in_messages) {
                    $message = Swat::_('%s is required.');
                } else {
                    $message = Swat::_('This field is required.');
                }
                $this->addMessage(new SwatMessage($message, 'error'));
            }
            $this->value = null;
        } elseif ($any_empty) {
            if ($this->show_field_title_in_messages) {
                $message = Swat::_('%s is not a valid time.');
            } else {
                $message = Swat::_('This is not a valid time.');
            }
            $this->addMessage(new SwatMessage($message, 'error'));
            $this->value = null;
        } else {
            try {
                $date = new SwatDate();
                if (
                    $date->setDate(
                        self::$date_year,
                        self::$date_month,
                        self::$date_day
                    ) === false
                ) {
                    throw new SwatException('Invalid date.');
                }

                if ($date->setTime($hour, $minute, $second) === false) {
                    throw new SwatException('Invalid date.');
                }

                $date->setTZById('UTC');

                $this->value = $date;
                $this->validateRanges();
            } catch (SwatException $e) {
                if ($this->show_field_title_in_messages) {
                    $message = Swat::_('%s is not a valid time.');
                } else {
                    $message = Swat::_('This is not a valid time.');
                }
                $this->addMessage(new SwatMessage($message, 'error'));
                $this->value = null;
            }
        }
    }
24103
public void validate() {
    if (interval == null || interval.isEmpty()) {
      throw new IllegalArgumentException("Missing or empty interval");
    }
    DateTime.parseDuration(interval);
    
    if (aggregator == null || aggregator.isEmpty()) {
      throw new IllegalArgumentException("Missing or empty aggregator");
    }
    try {
      Aggregators.get(aggregator.toLowerCase());
    } catch (final NoSuchElementException e) {
      throw new IllegalArgumentException("Invalid aggregator");
    }
    
    if (fill_policy != null) {
      fill_policy.validate();
    }
  }
184806
def _before_valid_time_range(self):
        
        if self.start_time is not None:
            try:
                if self.time < self.start_time:
                    return True
            except TypeError:
                return False
        return False
609376
protected function validateTimestamp($entry_id, $checkMissing = false)
    {
        if (!isset($_POST['action']['ignore-timestamp'])) {
            if ($checkMissing && !isset($_POST['action']['timestamp'])) {
                if (isset($this->_errors) && is_array($this->_errors)) {
                    $this->_errors['timestamp'] = __('The entry could not be saved due to conflicting changes');
                }
                return false;
            } elseif (isset($_POST['action']['timestamp'])) {
                $tv = new TimestampValidator('entries');
                if (!$tv->check($entry_id, $_POST['action']['timestamp'])) {
                    if (isset($this->_errors) && is_array($this->_errors)) {
                        $this->_errors['timestamp'] = __('The entry could not be saved due to conflicting changes');
                    }
                    return false;
                }
            }
        }
        return true;
    }
412721
def add_time_event(self, time_event):
        
        if isinstance(time_event, time_event_module.TimeEvent):
            self.time_events.append(time_event)
        else:
            raise TypeError("Type Error: received {}, but requires TimeEvent.".
                            format(type(time_event).__name__))
834834
void sendError( ServletRequest request, ServletResponse response, ServletContext servletContext,
                    int productionTimeErrorCode )
        throws IOException
    {
        InternalUtils.sendDevTimeError( _messageKeyPrefix, getMessageArgs(), null, productionTimeErrorCode,
                                        request, response, servletContext );
    }
58841
def validate_hour_lock(time, start_time)
      h0 = starting_unit(start_time)
      h1 = time.hour
      if h0 >= h1
        h0 - h1
      else
        if dst_offset = TimeUtil.dst_change(time)
          h0 - h1 + dst_offset
        else
          24 - h1 + h0
        end
      end
    end
1032718
synchronized void insert_except(DevFailed res, TimeVal when, TimeVal needed)
	{
		ring.insert_except(res,when);
		needed_time = needed;
	}
474300
def validate(self,
                 asset,
                 amount,
                 portfolio,
                 algo_datetime,
                 algo_current_data):
        
        if self.restrictions.is_restricted(asset, algo_datetime):
            self.handle_violation(asset, amount, algo_datetime)
59696
boolean hasValidTimes() {

        if ((getEnd() > 0L) && (getEnd() < System.currentTimeMillis())) {
            return false;
        }

        return ((getEnd() == 0) | (getStart() == 0)) || (getEnd() >= getStart());
    }
613883
protected function validateRun()
    {
        $status = $this->process->getExitCode();
        $error  = $this->process->getErrorOutput();

        if ($status !== 0 and $error !== '') {
            throw new \RuntimeException(
                sprintf(
                    "The exit status code %s says something went wrong:\n stderr: %s\n stdout: %s\ncommand: %s.",
                    $status,
                    $error,
                    $this->process->getOutput(),
                    $this->command
                )
            );
        }
    }
241665
def validate(self):
        
        for timeperiod, child in self.root.children.items():
            child.validate()
        self.validation_timestamp = datetime.utcnow()
1036658
def validate_a_time_filter(self, value):
        
        if value:
            try:
                utils.parse_datetime_range(value)
            except Exception as e:
                raise serializers.ValidationError(e.message)

        return value
1249713
private void validateAndSetClock(long newSimulationTime) {
     
    // We do not use the getClock routine here as 
    // the Engine and JobTracker clocks are different at
    // this point.
    long currentSimulationTime = clock.getTime();   
    if (newSimulationTime < currentSimulationTime) {
      // time has gone backwards
      throw new IllegalArgumentException("Time has gone backwards! " +
                                 "newSimulationTime: " + newSimulationTime +
                                 " while currentTime: " + 
                                 currentSimulationTime);
    }
    // the simulation time should also match that in the engine
    assert(newSimulationTime == engine.getCurrentTime()) : 
    	     " newTime =" + newSimulationTime + 
    	     " engineTime = " + engine.getCurrentTime();

    // set the current simulation time
    clock.setTime(newSimulationTime);
  }
896989
def validate_time(self, duration=False):
        
        super(TimeFilter, self).validate()
        timestamp = now = time.time()

        if str(self._value).isdigit():
            # Literal UNIX timestamp
            try:
                timestamp = float(self._value)
            except (ValueError, TypeError), exc:
                raise FilterError("Bad timestamp value %r in %r (%s)" % (self._value, self._condition, exc))
        else:
            # Something human readable
            delta = self.TIMEDELTA_RE.match(self._value)
            ##print self.TIMEDELTA_RE.pattern
            if delta:
                # Time delta
                for unit, val in delta.groupdict().items():
                    if val:
                        timestamp = self.TIMEDELTA_UNITS[unit](timestamp, int(val, 10))

                if duration:
                    timestamp = now - timestamp
                else:
                    # Invert logic for time deltas (+ = older; - = within the delta range)
                    if self._cmp == operator.lt:
                        self._cmp = operator.gt
                        self._rt_cmp = 'greater'
                    elif self._cmp == operator.gt:
                        self._cmp = operator.lt
                        self._rt_cmp = 'less'
            else:
                # Assume it's an absolute date
                if '/' in self._value:
                    # U.S.
                    dtfmt = "%m/%d/%Y"
                elif '.' in self._value:
                    # European
                    dtfmt = "%d.%m.%Y"
                else:
                    # Fall back to ISO
                    dtfmt = "%Y-%m-%d"

                val = str(self._value).upper().replace(' ', 'T')
                if 'T' in val:
                    # Time also given
                    dtfmt += "T%H:%M:%S"[:3+3*val.count(':')]

                try:
                    timestamp = time.mktime(time.strptime(val, dtfmt))
                except (ValueError), exc:
                    raise FilterError("Bad timestamp value %r in %r (%s)" % (self._value, self._condition, exc))

                if duration:
                    timestamp -= now

        self._value = timestamp
1185372
protected function prepareForValidation(): void
    {
        $data = $this->all();
        $duration = explode(' - ', $data['duration']);

        $data['starts_at'] = (new Carbon($duration[0]))->toDateTimeString();
        $data['ends_at'] = (new Carbon($duration[1]))->toDateTimeString();

        $this->replace($data);
    }
615667
private void validateTimes(int idx, SubPicture subPic,
			SubPicture subPicNext, SubPicture subPicPrev) {
		long startTime = subPic.getStartTime();
		long endTime = subPic.getEndTime();
		final long delay = 5000 * 90; // default delay for missing end time (5
										// seconds)

		idx += 1; // only used for display

		// get end time of last frame
		long lastEndTime = subPicPrev != null ? subPicPrev.getEndTime() : -1;

		if (startTime < lastEndTime) {
			startTime = lastEndTime;
		}

		// get start time of next frame
		long nextStartTime = subPicNext != null ? subPicNext.getStartTime() : 0;

		if (nextStartTime == 0) {
			if (endTime > startTime) {
				nextStartTime = endTime;
			} else {
				// completely messed up:
				// end time and next start time are invalid
				nextStartTime = startTime + delay;
			}
		}

		if (endTime <= startTime) {
			endTime = startTime + delay;
			if (endTime > nextStartTime) {
				endTime = nextStartTime;
			}
		} else if (endTime > nextStartTime) {
			endTime = nextStartTime;
		}

		int minTimePTS = configuration.getMinTimePTS();
		if (endTime - startTime < minTimePTS) {
			if (configuration.getFixShortFrames()) {
				endTime = startTime + minTimePTS;
				if (endTime > nextStartTime) {
					endTime = nextStartTime;
				}
			}
		}

		if (subPic.getStartTime() != startTime) {
			subPic.setStartTime(SubtitleUtils.syncTimePTS(startTime,
					configuration.getFpsTrg(), configuration.getFpsTrg()));
		}
		if (subPic.getEndTime() != endTime) {
			subPic.setEndTime(SubtitleUtils.syncTimePTS(endTime,
					configuration.getFpsTrg(), configuration.getFpsTrg()));
		}
	}