Skip to content

Commit 0373106

Browse files
author
Zhen Li
committed
Also fixed the time UTC->local change in pack methods
1 parent 1d71c18 commit 0373106

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

driver/src/main/java/org/neo4j/driver/internal/messaging/PackStreamMessageFormatV2.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,11 @@ private void packDate( LocalDate localDate ) throws IOException
133133

134134
private void packTime( OffsetTime offsetTime ) throws IOException
135135
{
136-
OffsetTime offsetTimeUtc = offsetTime.withOffsetSameInstant( UTC );
137-
long nanoOfDayUtc = offsetTimeUtc.toLocalTime().toNanoOfDay();
136+
long nanoOfDayLocal = offsetTime.toLocalTime().toNanoOfDay();
138137
int offsetSeconds = offsetTime.getOffset().getTotalSeconds();
139138

140139
packer.packStructHeader( TIME_STRUCT_SIZE, TIME );
141-
packer.pack( nanoOfDayUtc );
140+
packer.pack( nanoOfDayLocal );
142141
packer.pack( offsetSeconds );
143142
}
144143

driver/src/test/java/org/neo4j/driver/internal/messaging/PackStreamMessageFormatV2Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public void shouldWriteTime() throws Exception
190190
int index = buf.readableBytes() - Long.BYTES - Byte.BYTES - Integer.BYTES - Byte.BYTES;
191191
ByteBuf tailSlice = buf.slice( index, buf.readableBytes() - index );
192192

193-
assertByteBufContains( tailSlice, INT_64, time.withOffsetSameInstant( UTC ).toLocalTime().toNanoOfDay(), INT_32, time.getOffset().getTotalSeconds() );
193+
assertByteBufContains( tailSlice, INT_64, time.toLocalTime().toNanoOfDay(), INT_32, time.getOffset().getTotalSeconds() );
194194
}
195195

196196
@Test

0 commit comments

Comments
 (0)