/** * Constructs a XML Schema Time instance given a long representing the time in milliseconds. * By default a Time is not UTC and is local. * @param l The long value that represents the time instance. */ public Time (long l) { if (l > 86400000L) { throw new IllegalArgumentException("Bad Time: the long value can't represent more than 24h."); } this.setHour((short)(l / 3600000)); l = l % 3600000; this.setMinute((short)(l / 60000)); l = l % 60000; this.setSecond((short)(l / 1000), (short)(l % 1000)); }
/** * Sets all the fields by reading the values in an array. * <p> * if a Time Zone is specified it has to be set by using * {@link DateTimeBase#setZone(short, short) setZone}. * * @param values * an array of shorts with the values the array is supposed to be * of length 4 and ordered like that: * <ul> * <li>hour</li> * <li>minute</li> * <li>second</li> * <li>millisecond</li> * </ul> */ public void setValues(short[] values) { if (values.length != 4) { throw new IllegalArgumentException("Time#setValues: not the right number of values"); } this.setHour(values[0]); this.setMinute(values[1]); this.setSecond(values[2],values[3]); }
/** * Sets all the fields by reading the values in an array. * <p> * if a Time Zone is specified it has to be set by using {@link DateTimeBase#setZone(short, short) * setZone}. * * @param values an array of shorts with the values the array is supposed to be of length 4 and * ordered like that: * <ul> * <li>hour</li> * <li>minute</li> * <li>second</li> * <li>millisecond</li> * </ul> */ public void setValues(short[] values) { if (values.length != 4) { throw new IllegalArgumentException("Time#setValues: not the right number of values"); } this.setHour(values[0]); this.setMinute(values[1]); this.setSecond(values[2], values[3]); }
/** * Constructs a XML Schema Time instance given a long representing the time in milliseconds. * * @param l The long value that represents the time instance. * @param utc Does the long value represent a UTC time? */ public Time(long l, boolean utc) { if (l > 86400000L) { throw new IllegalArgumentException("Bad Time: the long value can't represent more than 24h."); } setHour((short) (l / 3600000)); l = l % 3600000; setMinute((short) (l / 60000)); l = l % 60000; setSecond((short) (l / 1000), (short) (l % 1000)); if (utc) { setZone((short) 0, (short) 0); } }
timeTarget.setHour(temp.getHour()); timeTarget.setMinute(temp.getMinute()); timeTarget.setSecond(temp.getSeconds(), temp.getMilli()); if (temp.isUTC()) { timeTarget.setUTC();
timeTarget.setHour(temp.getHour()); timeTarget.setMinute(temp.getMinute()); timeTarget.setSecond(temp.getSeconds(), temp.getMilli()); if (temp.isUTC()) { timeTarget.setUTC();