Skip to content

Commit

Permalink
[Improve] use system timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
liunaijie committed Oct 10, 2023
1 parent c4b18db commit 438bb10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@

import java.io.IOException;
import java.nio.ByteBuffer;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.LinkedHashMap;
Expand Down Expand Up @@ -189,7 +191,7 @@ private Object resolveObject(Object data, SeaTunnelDataType<?> seaTunnelDataType
case DATE:
return data;
case TIMESTAMP:
return ((LocalDateTime) data).toInstant(ZoneOffset.of("+8")).toEpochMilli();
return ((LocalDateTime) data).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
case BYTES:
return ByteBuffer.wrap((byte[]) data);
case ROW:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private Object resolveObject(Object field, SeaTunnelDataType<?> fieldType) {
return new Timestamp(timestamp).toLocalDateTime();
}
Instant instant = Instant.ofEpochMilli((long) field);
return LocalDateTime.ofInstant(instant, ZoneId.of("+8"));
return LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
case ROW:
SeaTunnelRowType rowType = (SeaTunnelRowType) fieldType;
Object[] objects = new Object[rowType.getTotalFields()];
Expand Down

0 comments on commit 438bb10

Please sign in to comment.