Esempio n. 1
0
  /** Sets the time in milliseconds since the epoch and calculate the internal variables. */
  public void setLocalTime(long time) {
    // If this is a local time zone date, just set the time
    if (_timeZone != _gmtTimeZone) {
      calculateSplit(time);
    }
    // If this is a GMT date, convert from local to GMT
    else {
      calculateSplit(time - _localTimeZone.getRawOffset());

      try {
        long offset =
            _localTimeZone.getOffset(
                GregorianCalendar.AD,
                (int) _year,
                (int) _month,
                (int) _dayOfMonth + 1,
                getDayOfWeek(),
                (int) _timeOfDay);

        calculateSplit(time - offset);
      } catch (Exception e) {
        log.log(Level.FINE, e.toString(), e);
      }
    }
  }
Esempio n. 2
0
  @Override
  public Object clone() {
    QDate newObj = new QDate(_timeZone);

    newObj.calculateSplit(_localTimeOfEpoch);

    return newObj;
  }
Esempio n. 3
0
  public long setTime(long hour, long minute, long second, long ms) {
    _hour = hour;
    _minute = minute;
    _second = second;
    _ms = ms;

    calculateJoin();
    calculateSplit(_localTimeOfEpoch);

    return _localTimeOfEpoch;
  }
Esempio n. 4
0
  /**
   * Sets date in the local time.
   *
   * @param year
   * @param month where January = 0
   * @param day day of month where the 1st = 1
   */
  public long setDate(long year, long month, long day) {
    year += (long) Math.floor(month / 12.0);
    month -= (long) 12 * Math.floor(month / 12.0);

    _year = year;
    _month = month;
    _dayOfMonth = day - 1;

    calculateJoin();
    calculateSplit(_localTimeOfEpoch);

    return _localTimeOfEpoch;
  }
Esempio n. 5
0
  /** Sets the millisecond, recalculating the localTimeOfEpoch. */
  public void setMillisecond(long millisecond) {
    _ms = millisecond;

    calculateJoin();
    calculateSplit(_localTimeOfEpoch);
  }
Esempio n. 6
0
  /** Sets the second, recalculating the localTimeOfEpoch. */
  public void setSecond(int second) {
    _second = second;

    calculateJoin();
    calculateSplit(_localTimeOfEpoch);
  }
Esempio n. 7
0
  /** Sets the minute, recalculating the localTimeOfEpoch. */
  public void setMinute(int minute) {
    _minute = minute;

    calculateJoin();
    calculateSplit(_localTimeOfEpoch);
  }
Esempio n. 8
0
  /** Sets the hour, recalculating the localTimeOfEpoch. */
  public void setHour(int hour) {
    _hour = hour;

    calculateJoin();
    calculateSplit(_localTimeOfEpoch);
  }
Esempio n. 9
0
 /** sets the day of the month based on 1 for the first of the month. */
 public void setDayOfMonth(int day) {
   _dayOfMonth = day - 1;
   calculateJoin();
   calculateSplit(_localTimeOfEpoch);
 }
Esempio n. 10
0
 /** Sets the month in the year. */
 public void setMonth(int month) {
   _month = month;
   calculateJoin();
   calculateSplit(_localTimeOfEpoch);
 }
Esempio n. 11
0
  /** Sets the year, recalculating the time since epoch. */
  public void setYear(int year) {
    _year = year;

    calculateJoin();
    calculateSplit(_localTimeOfEpoch);
  }
Esempio n. 12
0
  /** Sets the time in milliseconds since the epoch and calculate the internal variables. */
  public void setGMTTime(long time) {
    calculateSplit(time + _timeZone.getRawOffset());

    // need to recalculate for daylight time
    if (_isDaylightTime) calculateSplit(time + _zoneOffset);
  }