Skip to content

Commit 60dfb2c

Browse files
Fixed bug: interval value parsing in microseconds and double instead of ticks. (#499)
* fix bug: interval value parsing * Update CHANGELOG.md
1 parent 5ec38b4 commit 60dfb2c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Ydb.Sdk/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
- Fixed bug: interval value parsing in microseconds and double instead of ticks.
12
- ADO.NET: Changed `IBulkUpsertImporter.AddRowAsync` signature: `object?[] row``params object[]`.
23

34
## v0.21.0

src/Ydb.Sdk/src/Value/YdbValueParser.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Ydb.Sdk.Ado;
1+
using Google.Protobuf.WellKnownTypes;
2+
using Ydb.Sdk.Ado;
23

34
namespace Ydb.Sdk.Value;
45

@@ -96,7 +97,7 @@ public DateTime GetTimestamp()
9697
public TimeSpan GetInterval()
9798
{
9899
EnsurePrimitiveTypeId(Type.Types.PrimitiveTypeId.Interval);
99-
return TimeSpan.FromMilliseconds((double)_protoValue.Int64Value / 1000);
100+
return TimeSpan.FromTicks(_protoValue.Int64Value * (1000 / Duration.NanosecondsPerTick));
100101
}
101102

102103
public byte[] GetString()

0 commit comments

Comments
 (0)