Exemplo n.º 1
0
  /**
   * Returns multiple values of hours, minutes, seconds, milliseconds for the calendar date <code>
   * date</code> in <code>timezone</code>. <code>timezone</code> is the number of hours added to UTC
   * to get local time. It is in the range -12.0 to +14.0 where UTC is zone 0.0
   *
   * @param timezone
   * @param MV_returnarray
   * @return int
   */
  public int getTime(double timezone, Object[] MV_returnarray) {
    {
      CalendarDate date = this;

      if (timezone == Stella.NULL_FLOAT) {
        Stella.STANDARD_WARNING.nativeStream.println(
            "Warning: Timezone not specified in GET-TIME.  Using local zone.");
        {
          int year = Stella.NULL_INTEGER;
          int month = Stella.NULL_INTEGER;
          int day = Stella.NULL_INTEGER;
          Keyword dow = null;

          {
            Object[] caller_MV_returnarray = new Object[3];

            year =
                Stella.computeCalendarDate(
                    Stella.modifiedJulianDayToJulianDay(date.modifiedJulianDay),
                    caller_MV_returnarray);
            month = ((int) (((IntegerWrapper) (caller_MV_returnarray[0])).wrapperValue));
            day = ((int) (((IntegerWrapper) (caller_MV_returnarray[1])).wrapperValue));
            dow = ((Keyword) (caller_MV_returnarray[2]));
          }
          dow = dow;
          timezone = Stella.getLocalTimeZoneForDate(year, month, day, 12, 0, 0);
        }
      }
      if (timezone == 0.0) {
        return (Stella.decodeTimeInMillis(date.timeMillis, MV_returnarray));
      } else if (timezone < 0.0) {
        return (Stella.decodeTimeInMillis(
            ((((int)
                    (date.timeMillis
                        + Stella.MILLIS_PER_DAY
                        + (timezone * Stella.MILLIS_PER_HOUR))))
                % Stella.MILLIS_PER_DAY),
            MV_returnarray));
      } else {
        return (Stella.decodeTimeInMillis(
            ((((int) (date.timeMillis + (timezone * Stella.MILLIS_PER_HOUR))))
                % Stella.MILLIS_PER_DAY),
            MV_returnarray));
      }
    }
  }
Exemplo n.º 2
0
  /**
   * Returns multiple values of year, month, day and day of week for <code>date</code> in <code>
   * timezone</code>. <code>timezone</code> is the number of hours added to UTC to get local time.
   * It is in the range -12.0 to +14.0 where UTC is zone 0.0
   *
   * @param timezone
   * @param MV_returnarray
   * @return int
   */
  public int getCalendarDate(double timezone, Object[] MV_returnarray) {
    {
      CalendarDate date = this;

      if (timezone == Stella.NULL_FLOAT) {
        Stella.STANDARD_WARNING.nativeStream.println(
            "Warning: Timezone not specified in GET-CALENDAR-DATE  Using local zone.");
        {
          int year = Stella.NULL_INTEGER;
          int month = Stella.NULL_INTEGER;
          int day = Stella.NULL_INTEGER;
          Keyword dow = null;

          {
            Object[] caller_MV_returnarray = new Object[3];

            year =
                Stella.computeCalendarDate(
                    Stella.modifiedJulianDayToJulianDay(date.modifiedJulianDay),
                    caller_MV_returnarray);
            month = ((int) (((IntegerWrapper) (caller_MV_returnarray[0])).wrapperValue));
            day = ((int) (((IntegerWrapper) (caller_MV_returnarray[1])).wrapperValue));
            dow = ((Keyword) (caller_MV_returnarray[2]));
          }
          dow = dow;
          timezone = Stella.getLocalTimeZoneForDate(year, month, day, 12, 0, 0);
        }
      }
      {
        int time = date.timeMillis;
        int timezoneAdjustedTime = ((int) (time + (timezone * Stella.MILLIS_PER_HOUR)));
        int dayOffset = 0;

        if (timezoneAdjustedTime < 0) {
          dayOffset = -1;
        } else if (timezoneAdjustedTime > Stella.MILLIS_PER_DAY) {
          dayOffset = 1;
        } else {
        }
        return (Stella.computeCalendarDate(
            Stella.modifiedJulianDayToJulianDay(date.modifiedJulianDay + dayOffset),
            MV_returnarray));
      }
    }
  }