aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2015-02-12 10:36:48 -0800
committerGravatar Jan Tattermusch <jtattermusch@google.com>2015-02-12 14:18:03 -0800
commit86a249f6f04ba652464da5167ba4d195072d4c3e (patch)
tree749807a0d4fd2608956494d7dc9342298747664a /src/csharp
parente1e11878cbb651bb4528401e92ffead9c1911a37 (diff)
little refactoring for Timespec
Diffstat (limited to 'src/csharp')
-rw-r--r--src/csharp/GrpcCore/Internal/Timespec.cs8
-rw-r--r--src/csharp/GrpcCoreTests/TimespecTest.cs13
2 files changed, 21 insertions, 0 deletions
diff --git a/src/csharp/GrpcCore/Internal/Timespec.cs b/src/csharp/GrpcCore/Internal/Timespec.cs
index d874691172..c069829d8c 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 484bad7ca1..4de310372d 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
@@ -13,6 +14,18 @@ namespace Google.GRPC.Core.Internal.Tests
}
[Test]
+ public void InfFuture()
+ {
+ var timespec = Timespec.InfFuture;
+ }
+
+ [Test]
+ public void TimespecSizeIsNativeSize()
+ {
+ Assert.AreEqual(Timespec.NativeSize, Marshal.SizeOf(typeof(Timespec)));
+ }
+
+ [Test]
public void Add()
{
var t = new Timespec { tv_sec = 12345, tv_nsec = 123456789 };