Return ``True`` if ``x`` is a valid H:MM:SS or HH:MM:SS time;
    otherwise return ``False``.
161251
def valid_time(x: str) -> bool:
    
    if isinstance(x, str) and (
        re.match(TIME_PATTERN1, x) or re.match(TIME_PATTERN2, x)
    ):
        return True
    else:
        return False
801076
public boolean checkTimeframeArg(String timeframe) {
        if (Pattern.compile("\\d*(d|h)", Pattern.CASE_INSENSITIVE).matcher(timeframe).matches()) {
            return true;
        } else {
            return false;
        }
    }
1192938
def _onOffset(self, dt, businesshours):
        
        # if self.normalize and not _is_normalized(dt):
        #     return False
        # Valid BH can be on the different BusinessDay during midnight
        # Distinguish by the time spent from previous opening time
        if self.n >= 0:
            op = self._prev_opening_time(dt)
        else:
            op = self._next_opening_time(dt)
        span = (dt - op).total_seconds()
        if span <= businesshours:
            return True
        else:
            return False
1298306
def is_time_variable(varname, var):
    
    satisfied = varname.lower() == 'time'
    satisfied |= getattr(var, 'standard_name', '') == 'time'
    satisfied |= getattr(var, 'axis', '') == 'T'
    satisfied |= units_convertible('seconds since 1900-01-01', getattr(var, 'units', ''))
    return satisfied
296817
def check_time_param(t):
    """"""

    if type(t) is str:
        if not ISO.match(t):
            raise ValueError('Date string "%s" does not match ISO8601 format' %
                             (t))
        return t
    else:
        return t.isoformat()
942948
def validate_args(args):
    
    if not args.minutes and not args.start_time:
        print("Error: missing --minutes or --start-time")
        return False
    if args.minutes and args.start_time:
        print("Error: --minutes shouldn't be specified if --start-time is used")
        return False
    if args.end_time and not args.start_time:
        print("Error: --end-time can't be used without --start-time")
        return False
    if args.minutes and args.minutes <= 0:
        print("Error: --minutes must be > 0")
        return False
    if args.start_time and not TIME_FORMAT_REGEX.match(args.start_time):
        print("Error: --start-time format is not valid")
        print("Example format: '2015-11-26 11:00:00'")
        return False
    if args.end_time and not TIME_FORMAT_REGEX.match(args.end_time):
        print("Error: --end-time format is not valid")
        print("Example format: '2015-11-26 11:00:00'")
        return False
    if args.batch_size <= 0:
        print("Error: --batch-size must be > 0")
        return False
    return True
890882
def is_correct(self):
        
        valid = self.day in Daterange.weekdays
        if not valid:
            logger.error("Error: %s is not a valid day", self.day)
        # Check also if Daterange is correct.
        valid &= super(StandardDaterange, self).is_correct()
        return valid
50026
def is_time_day_valid(self, timestamp):
        
        (start_time, end_time) = self.get_start_and_end_time(timestamp)
        return start_time <= timestamp <= end_time
1046635
function isValidHour(hour) {
    const min = self.min() ? self.min().hour : 0;
    const max = self.max() ? self.max().hour : 23;
    if (self.reversed()) {
      return hour <= max || min <= hour;
    }
    return min <= hour && hour <= max;
  }
555030
private static boolean isunixtimeleap( double unixTime ) {
        double gpsTime = unixTime - 315964800;
        gpsTime += countleaps(gpsTime, true) - 1;

        return isleap(gpsTime);
    }
663662
def DatetimeWithTZ(msg=None):
    '''
    
    '''
    def fn(value):
        try:
            date = parse_datetime(value) or parse_date(value)
            if date is not None:
                return date
            else:
                raise ValueError
        except ValueError:
            raise Invalid('<{0}> is not a valid datetime.'.format(value))
    return fn
1113120
def date_matches(self, timestamp):
        """"""
        if self.date is None:
            return False

        timestamp = datetime.fromtimestamp(float(timestamp), self.timezone)
        if self.date.date() == timestamp.date():
            return True

        return False
941064
def _check_time_fn(self, time_instance=False):
        
        if time_instance and not isinstance(self.time_fn, param.Time):
            raise AssertionError("%s requires a Time object"
                                 % self.__class__.__name__)

        if self.time_dependent:
            global_timefn = self.time_fn is param.Dynamic.time_fn
            if global_timefn and not param.Dynamic.time_dependent:
                raise AssertionError("Cannot use Dynamic.time_fn as"
                                     " parameters are ignoring time.")
410349
def matches?(time)

      time = Time.at(time) unless time.kind_of?(Time)

      time = @timezone.utc_to_local(time.getutc) if @timezone

      return false unless sub_match?(time, :sec, @seconds)
      return false unless sub_match?(time, :min, @minutes)
      return false unless sub_match?(time, :hour, @hours)
      return false unless date_match?(time)
      true
    end
1296143
def check_time(value):
    """"""
    if value is None:
        return None
    if isinstance(value, (time.struct_time, tuple)):
        return value
    if isinstance(value, datetime.datetime):
        return value.timetuple()
    if isinstance(value, datetime.date):
        res = datetime.datetime.utcnow()
        res.replace(year=value.year, month=value.month, day=value.day)
        return res.timetuple()
    if isinstance(value, datetime.time):
        return datetime.datetime.combine(datetime.date.today(),
                                         value).timetuple()
    if isinteger(value):
        # Handle integer as timestamp
        return time.gmtime(value)
    if isinstance(value, basestring):
        if value.lower() == 'now':
            return time.gmtime()
        # TODO: parsinng some popular strings
    raise ValueError("Unsupported time representation:" + repr(value))
387951
function validTimestamp(timestamp) {
    // ^year-month-day(Thour:min:secms?timezone)?$
    var year = /((?:[1-9][0-9]*)?[0-9]{4})/,
        month = /(1[0-2]|0[1-9])/,
        day = /(3[01]|0[1-9]|[12][0-9])/,
        hour = /(2[0-3]|[01][0-9])/,
        minute = /([0-5][0-9])/,
        second = /([0-5][0-9])/,
        ms = /(\.[0-9]+)/,
        timezone = /(Z|[+\-](?:2[0-3]|[01][0-9]):[0-5][0-9])/,
        date = [year.source, month.source, day.source].join('-'),
        time = [hour.source, minute.source, second.source].join(':'),
        timestampRegex,
        result;

    timestampRegex = new RegExp(
        '^' + date + '(T' + time + ms.source + '?' + timezone.source + ')?$'
    );

    result = timestampRegex.exec(timestamp);

    return result !== null;
}
1090824
def is_timestamp(obj):
    
    return isinstance(obj, datetime.datetime) or is_string(obj) or is_int(obj) or is_float(obj)