diff --git a/src/csharp/GrpcCore/Internal/Timespec.cs b/src/csharp/GrpcCore/Internal/Timespec.cs index d874691172ad34ccddc47f69c18596a86af43b67..c069829d8c7e256f0f2eea7c7940e1bae1541ae4 100644 --- a/src/csharp/GrpcCore/Internal/Timespec.cs +++ b/src/csharp/GrpcCore/Internal/Timespec.cs @@ -46,6 +46,14 @@ namespace Google.GRPC.Core.Internal } } + internal static int NativeSize + { + get + { + return gprsharp_sizeof_timespec(); + } + } + /// <summary> /// Creates a GPR deadline from current instant and given timeout. /// </summary> diff --git a/src/csharp/GrpcCoreTests/TimespecTest.cs b/src/csharp/GrpcCoreTests/TimespecTest.cs index 484bad7ca19a4b3953ada37e706f76d798187556..4de310372d50144be6ca8b86d9d214bd52d7d6c4 100644 --- a/src/csharp/GrpcCoreTests/TimespecTest.cs +++ b/src/csharp/GrpcCoreTests/TimespecTest.cs @@ -1,5 +1,6 @@ using System; using NUnit.Framework; +using System.Runtime.InteropServices; using Google.GRPC.Core.Internal; namespace Google.GRPC.Core.Internal.Tests @@ -12,6 +13,18 @@ namespace Google.GRPC.Core.Internal.Tests var timespec = Timespec.Now; } + [Test] + public void InfFuture() + { + var timespec = Timespec.InfFuture; + } + + [Test] + public void TimespecSizeIsNativeSize() + { + Assert.AreEqual(Timespec.NativeSize, Marshal.SizeOf(typeof(Timespec))); + } + [Test] public void Add() {