Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
youfanx committed Jul 5, 2024
1 parent 5b55ecf commit a35cdf7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion rxlib/src/main/java/org/rx/core/Reflects.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Class<?> stackClass(int depth) {
registerConvert(Number.class, Decimal.class, (sv, tt) -> Decimal.valueOf(sv.doubleValue()));
registerConvert(NEnum.class, Integer.class, (sv, tt) -> sv.getValue());
registerConvert(Long.class, Date.class, (sv, tt) -> new Date(sv));
registerConvert(Long.class, DateTime.class, (sv, tt) -> new DateTime(sv));
registerConvert(Long.class, DateTime.class, (sv, tt) -> new DateTime(sv, TimeZone.getDefault()));
registerConvert(Date.class, Long.class, (sv, tt) -> sv.getTime());
registerConvert(Date.class, DateTime.class, (sv, tt) -> DateTime.of(sv));
registerConvert(String.class, BigDecimal.class, (sv, tt) -> new BigDecimal(sv));
Expand Down
7 changes: 4 additions & 3 deletions rxlib/src/test/java/org/rx/bean/TestBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.time.Month;
import java.util.HashSet;
import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.CountDownLatch;

import static org.rx.core.Extends.eq;
Expand Down Expand Up @@ -182,8 +183,8 @@ public void decimal() {
public void dateTime() {
DateTime now = DateTime.now();
DateTime utc = DateTime.utcNow();
DateTime d = new DateTime(2010, Month.AUGUST, 24, 11, 12, 13);
DateTime d3 = new DateTime(2010, Month.AUGUST, 23, 11, 12, 13);
DateTime d = new DateTime(2010, Month.AUGUST, 24, 11, 12, 13, TimeZone.getDefault());
DateTime d3 = new DateTime(2010, Month.AUGUST, 23, 11, 12, 13, TimeZone.getDefault());

assert now.getTime() == utc.getTime();
assert d.getYear() == 2010;
Expand Down Expand Up @@ -212,7 +213,7 @@ public void dateTime() {
assert nd.getDayOfWeek() == DayOfWeek.WEDNESDAY;
log.info("{} nextDayOfWeek {}", nd, nd.nextDayOfWeek());
log.info("{} lastDayOfMonth {}", nd, nd.lastDayOfMonth());
log.info("{} isToday {}", nd, nd.isToday());
// log.info("{} isToday {}", nd, nd.isToday());
}

@Test
Expand Down
5 changes: 3 additions & 2 deletions rxlib/src/test/java/org/rx/core/TestAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Map;
import java.util.TimeZone;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ForkJoinPool;
Expand Down Expand Up @@ -72,7 +73,7 @@ public void agentTime2() {
static void ntp() {
long ts = System.currentTimeMillis();
System.out.println(ts);
System.out.println(new DateTime(ts));
System.out.println(new DateTime(ts, TimeZone.getDefault()));

//inject
NtpClock.transform();
Expand All @@ -81,7 +82,7 @@ static void ntp() {
System.out.println(ts);
ts = NtpClock.UTC.millis();
System.out.println(ts);
System.out.println(new DateTime(ts));
System.out.println(new DateTime(ts, TimeZone.getDefault()));
}

static void fjp() throws Throwable {
Expand Down

0 comments on commit a35cdf7

Please sign in to comment.