Adjusts the given time either rounding it up or down.

@param time
the time to adjust
@param roundUp
the rounding direction
@param firstDayOfWeek
the first day of the week (needed for rounding weeks)
@return the adjusted time
352811
public LocalDateTime adjustTime(LocalDateTime time, boolean roundUp,
                                    DayOfWeek firstDayOfWeek) {
        requireNonNull(time);

        if (roundUp) {
            time = time.plus(getAmount(), getUnit());
        }

        return Util.truncate(time, getUnit(), getAmount(), firstDayOfWeek);
    }
524826
public static void setLocal(String time) {
		SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
		Date result = null;
		try {
			result = sdf.parse(time);
		}
		catch (ParseException pex) {
			throw new RuntimeException("Time is not parseable (" + time + ")", pex);
		}
		setClock(Clock.fixed(result.toInstant(), ZoneId.systemDefault()));
	}
339309
public int mapTo(final int dayOfWeek, final WeekDay targetWeekDayDefinition) {
        if (firstDayZero && targetWeekDayDefinition.isFirstDayZero()) {
            return bothSameStartOfRange(0, 6, this, targetWeekDayDefinition).apply(dayOfWeek);
        }
        if (!firstDayZero && !targetWeekDayDefinition.isFirstDayZero()) {
            return bothSameStartOfRange(1, 7, this, targetWeekDayDefinition).apply(dayOfWeek);
        }
        //start range is different for each case. We need to normalize ranges
        if (targetWeekDayDefinition.isFirstDayZero()) {
            //my range is 1-7. I normalize ranges, get the "zero" mapping and turn result into original scale
            return mapTo(dayOfWeek, new WeekDay(targetWeekDayDefinition.getMondayDoWValue() + 1, false)) - 1;
        } else {
            //my range is 0-6. I normalize ranges, get the "one" mapping and turn result into original scale
            return mapTo(dayOfWeek, new WeekDay(targetWeekDayDefinition.getMondayDoWValue() - 1, true)) + 1;
        }
    }
778811
public static Long dehumanize(String time) {
		Long result = getHumantimeCache().get(time);
		if (result == null) {
			if (isNotBlank(time)) {
				String input = time.trim();
				if (NumberUtils.isDigits(input)) {
					result = NumberUtils.toLong(input);
				}
				else {
					Matcher matcher = PATTERN_HUMAN_TIME.matcher(input);
					if (matcher.matches()) {
						long sum = 0L;
						sum += dehumanizeUnit(matcher.group(1), MS_WEEK);
						sum += dehumanizeUnit(matcher.group(2), MS_DAY);
						sum += dehumanizeUnit(matcher.group(3), MS_HOUR);
						sum += dehumanizeUnit(matcher.group(4), MS_MINUTE);
						sum += dehumanizeUnit(matcher.group(5), MS_SECOND);
						sum += dehumanizeUnit(matcher.group(6), MS_MILLISECOND);
						result = sum;
					}
				}
				getHumantimeCache().put(time, result);
			}
		}
		return result;
	}
1275851
public synchronized Date setEndDate(Date time)
    {
        m_cachedInfo.setEndDate(time);
        int iThisIndex = m_model.indexOf(this);
        if (iThisIndex != -1)
            m_model.fireTableRowsUpdated(iThisIndex, iThisIndex);
        this.changeRemoteDate(null, null, this, null, time);
        return this.getEndDate();
    }
589539
public WeeklyAutoScalingSchedule withWednesday(java.util.Map<String, String> wednesday) {
        setWednesday(wednesday);
        return this;
    }
1237508
public function friendlyTime($time)
    {
        $time = $this->formatTime($time);
        (int) $s = 60;
        (int) $hour = $s * $s;
        (int) $day = $hour * 24;
        (int) $week = $day * 7;
        (int) $month = $day * 30;
        (int) $year = $month * 12;
        if ($time <= 60) {
            $ago = ($time === 0 || $time === 1) ? printl('z:format:just:now') : sprintf(printl('z:format:secs'), $time).' '.printl('z:format:ago');
        } elseif ($time >= $s && $time < $hour) {
            $ago = (round($time / $s) === 1) ? '1 '.printl('z:format:min').' '.printl('z:format:ago') : sprintf(printl('z:format:mints'), round($time / $s)).' '.printl('z:format:ago');
        } elseif ($time >= $hour && $time < $day) {
            $ago = (round($time / $hour) === 1) ? '1 '.printl('z:format:hour').' '.printl('z:format:ago') : sprintf(printl('z:format:hours'), round($time / $hour)).' '.printl('z:format:ago');
        } elseif ($time >= $day && $time < $week) {
            $ago = (round($time / $day) === 1) ? '1 '.printl('z:format:day').' '.printl('z:format:ago') : sprintf(printl('z:format:days'), round($time / $day)).' '.printl('z:format:ago');
        } elseif ($time >= $week && $time < $month) {
            $ago = (round($time / $week) === 1) ? '1 '.printl('z:format:week').' '.printl('z:format:ago') : sprintf(printl('z:format:weeks'), round($time / $week)).' '.printl('z:format:ago');
        } elseif ($time >= $month && $time < $year) {
            $ago = (round($time / $month) === 1) ? '1 '.printl('z:format:month').' '.printl('z:format:ago') : sprintf(printl('z:format:months'), round($time / $month)).' '.printl('z:format:ago');
        } elseif ($time >= $month) {
            $ago = (round($time / $month) === 1) ? '1 '.printl('z:format:year').' '.printl('z:format:ago') : sprintf(printl('z:format:years'), round($time / $year)).' '.printl('z:format:ago');
        }

        return $ago;
    }
348269
public Calendar adjustDate(final Calendar startDate, final int increment, final NonWorkingDayChecker<Calendar> checker) {
         final Calendar cal = (Calendar) startDate.clone();
         int step = increment;
         final int month = cal.get(Calendar.MONTH);

         while (checker.isNonWorkingDay(cal)) {
             cal.add(Calendar.DAY_OF_MONTH, step);
             if (month != cal.get(Calendar.MONTH)) {
                 // switch direction and go back
                 step *= -1;
                 cal.add(Calendar.DAY_OF_MONTH, step);
             }
         }

         return cal;
     }
1028370
public static Date getFirstDayFromCurrentWeek(Date d) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(d);        
        cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        return cal.getTime();
    }
791267
public synchronized Date setStartDate(Date time)
    {
        if ((m_startTime != null) && (m_endTime != null) && (time != null))
        {   // As a default, shift the end date the same distance as the start date
            long lChange = time.getTime() - m_startTime.getTime();
            m_endTime = new Date(m_endTime.getTime() + lChange);
        }
        m_startTime = time;
        return this.getStartDate();
    }
1218829
public static LocalDateTime toDate(Day day, Time time)
   {

      time.assignDate(LocalDateTime.of(day.getLocalDate(),
      time.getLocalDateTime().toLocalTime()));
      
      return time.getLocalDateTime();
   }
24679
public com.google.type.TimeOfDay getTime() {
    return time_ == null ? com.google.type.TimeOfDay.getDefaultInstance() : time_;
  }
85877
public void setFirstDayOfWeek(int value)
    {
        if (firstDayOfWeek != value) {
            if (value < SUNDAY || value > SATURDAY) {
                throw new IllegalArgumentException("Invalid day of week");
            }
            firstDayOfWeek = value;
            areFieldsSet = false;
        }
    }
10525
private String convertTime(final long time) {
    final Date date = new Date(time);
    return FORMAT.format(date);
  }
410658
public static int convertDayOfWeekFromTimeToCalendar(int timeDayOfWeek) {
        switch (timeDayOfWeek) {
            case Time.MONDAY:
                return Calendar.MONDAY;
            case Time.TUESDAY:
                return Calendar.TUESDAY;
            case Time.WEDNESDAY:
                return Calendar.WEDNESDAY;
            case Time.THURSDAY:
                return Calendar.THURSDAY;
            case Time.FRIDAY:
                return Calendar.FRIDAY;
            case Time.SATURDAY:
                return Calendar.SATURDAY;
            case Time.SUNDAY:
                return Calendar.SUNDAY;
            default:
                throw new IllegalArgumentException("Argument must be between Time.SUNDAY and " +
                        "Time.SATURDAY");
        }
    }
205096
public Date adjustDate(final Date startDate, final int increment, final NonWorkingDayChecker<Date> checker) {
        final Calendar cal = Utils.getCal(startDate);

        while (checker.isNonWorkingDay(cal.getTime())) {
            if (increment < 0) {
                cal.add(Calendar.DAY_OF_MONTH, -1);
            } else {
                cal.add(Calendar.DAY_OF_MONTH, 1);
            }
        }

        return cal.getTime();
    }
50540
public static Calendar round(Calendar calendar, DateField dateField) {
		return DateModifier.modify(calendar, dateField.getValue(), ModifyType.ROUND);
	}