Skip to content

Commit

Permalink
Specify time unit as variable suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
safris committed Dec 17, 2024
1 parent 21346ef commit d056afc
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
8 changes: 4 additions & 4 deletions datatype/src/main/java/org/openjax/xml/datatype/Date.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ public Date(final int year, final int month, final int day) {
this(year, month, day, null);
}

public Date(final long time, final TimeZone timeZone) {
this(new YearMonth(time, timeZone), new Day(time), null);
public Date(final long timeMs, final TimeZone timeZone) {
this(new YearMonth(timeMs, timeZone), new Day(timeMs), null);
}

public Date(final long time) {
this(new YearMonth(time), new Day(time), null);
public Date(final long timeMs) {
this(new YearMonth(timeMs), new Day(timeMs), null);
}

public Date() {
Expand Down
8 changes: 4 additions & 4 deletions datatype/src/main/java/org/openjax/xml/datatype/DateTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ public DateTime(final int year, final int month, final int day, final int hour,
this(year, month, day, hour, minute, second, null);
}

public DateTime(final long time, final TimeZone timeZone) {
this(new Date(time, timeZone), new Time(time, timeZone));
public DateTime(final long timeMs, final TimeZone timeZone) {
this(new Date(timeMs, timeZone), new Time(timeMs, timeZone));
}

public DateTime(final long time) {
this(new Date(time), new Time(time));
public DateTime(final long timeMs) {
this(new Date(timeMs), new Time(timeMs));
}

public DateTime() {
Expand Down
4 changes: 2 additions & 2 deletions datatype/src/main/java/org/openjax/xml/datatype/Day.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ public Day(final int day) {
}

@SuppressWarnings("deprecation")
public Day(final long time) {
public Day(final long timeMs) {
super(TimeZone.getDefault());
this.day = new java.util.Date(time).getDate();
this.day = new java.util.Date(timeMs).getDate();
}

public Day() {
Expand Down
4 changes: 2 additions & 2 deletions datatype/src/main/java/org/openjax/xml/datatype/Month.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public Month(final int month) {
}

@SuppressWarnings("deprecation")
public Month(final long time) {
public Month(final long timeMs) {
super(TimeZone.getDefault());
this.month = new java.util.Date(time).getMonth() + 1;
this.month = new java.util.Date(timeMs).getMonth() + 1;
}

public Month() {
Expand Down
4 changes: 2 additions & 2 deletions datatype/src/main/java/org/openjax/xml/datatype/MonthDay.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public MonthDay(final int month, final int day) {
this(month, day, null);
}

public MonthDay(final long time) {
this(new Month(time), new Day(time), null);
public MonthDay(final long timeMs) {
this(new Month(timeMs), new Day(timeMs), null);
}

public MonthDay() {
Expand Down
16 changes: 8 additions & 8 deletions datatype/src/main/java/org/openjax/xml/datatype/Time.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@
* http://www.w3.org/TR/xmlschema11-2/#time
*/
public class Time extends TemporalType {
static Calendar newCalendar(final long time, final TimeZone timeZone) {
static Calendar newCalendar(final long timeMs, final TimeZone timeZone) {
if (timeZone == null)
throw new IllegalArgumentException("timeZone is null");

final Calendar calendar = Calendar.getInstance(timeZone);
calendar.setTimeInMillis(time);
calendar.setTimeInMillis(timeMs);
return calendar;
}

static Calendar newCalendar(final long time) {
static Calendar newCalendar(final long timeMs) {
final Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(time);
calendar.setTimeInMillis(timeMs);
return calendar;
}

Expand Down Expand Up @@ -191,16 +191,16 @@ public Time(final int hours, final int minutes, final float seconds) {
this(hours, minutes, seconds, null);
}

public Time(final long time, final TimeZone timeZone) {
public Time(final long timeMs, final TimeZone timeZone) {
super(timeZone);
final Calendar calendar = newCalendar(time, this.timeZone);
final Calendar calendar = newCalendar(timeMs, this.timeZone);
this.hour = calendar.get(Calendar.HOUR);
this.minute = calendar.get(Calendar.MINUTE);
this.second = calendar.get(Calendar.SECOND) + calendar.get(Calendar.MILLISECOND) / 1000f;
}

public Time(final long time) {
this(time, null);
public Time(final long timeMs) {
this(timeMs, null);
}

public Time() {
Expand Down
8 changes: 4 additions & 4 deletions datatype/src/main/java/org/openjax/xml/datatype/Year.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ public Year(final int year) {
this(year, null);
}

public Year(final long time, final TimeZone timeZone) {
this(Time.newCalendar(time, timeZone).get(Calendar.YEAR), null);
public Year(final long timeMs, final TimeZone timeZone) {
this(Time.newCalendar(timeMs, timeZone).get(Calendar.YEAR), null);
}

public Year(final long time) {
this(Time.newCalendar(time).get(Calendar.YEAR), null);
public Year(final long timeMs) {
this(Time.newCalendar(timeMs).get(Calendar.YEAR), null);
}

public Year() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ public YearMonth(final int year, final int month) {
this(year, month, null);
}

public YearMonth(final long time, final TimeZone timeZone) {
this(new Year(time, timeZone), new Month(time), timeZone);
public YearMonth(final long timeMs, final TimeZone timeZone) {
this(new Year(timeMs, timeZone), new Month(timeMs), timeZone);
}

public YearMonth(final long time) {
this(new Year(time), new Month(time), null);
public YearMonth(final long timeMs) {
this(new Year(timeMs), new Month(timeMs), null);
}

public YearMonth() {
Expand Down

0 comments on commit d056afc

Please sign in to comment.