Skip to content

Timezone fix while deserializing MySQL cell #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


[Build Status]:https://travis-ci.org/mysql-time-machine/replicator
[Build Status img]:https://travis-ci.org/mysql-time-machine/replicator.svg?branch=master
[Coverage Status]:https://codecov.io/gh/mysql-time-machine/replicator
Expand All @@ -162,3 +163,4 @@ limitations under the License.
[Known Vulnerabilities]:https://snyk.io/test/github/mysql-time-machine/replicator
[license]:LICENSE
[license img]:https://img.shields.io/badge/license-Apache%202-blue.svg

Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static Object convertToObject(Serializable cellValue, ColumnSchema column
case TIMESTAMP: {
Long timestamp = (Long) cellValue;

ZoneId zoneId = ZonedDateTime.now().getZone();
ZoneId zoneId = ZoneId.of("UTC");
LocalDateTime aLDT = Instant.ofEpochMilli(timestamp).atZone(zoneId).toLocalDateTime();

Integer offset = ZonedDateTime.from(aLDT.atZone(zoneId)).getOffset().getTotalSeconds();
Expand Down