diff options
author | David Garcia Quintas <dgq@google.com> | 2015-07-23 04:26:24 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2015-07-23 04:26:24 -0700 |
commit | baa2aa644226b00ad9cb493660356f4473acd212 (patch) | |
tree | 13ffebed603924ac83e0c77df5133b855f826de0 /src/csharp/Grpc.Core.Tests/TimespecTest.cs | |
parent | 8ec09f6530938c6126a6579ce85ee07dbf71d785 (diff) | |
parent | d435caa13eb3710a4d3d17825b0efe3a06336ab7 (diff) |
Merge branch 'master' of github.com:grpc/grpc into compression-accept-encoding
Diffstat (limited to 'src/csharp/Grpc.Core.Tests/TimespecTest.cs')
-rw-r--r-- | src/csharp/Grpc.Core.Tests/TimespecTest.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/csharp/Grpc.Core.Tests/TimespecTest.cs b/src/csharp/Grpc.Core.Tests/TimespecTest.cs index 5831121add..a34b407a01 100644 --- a/src/csharp/Grpc.Core.Tests/TimespecTest.cs +++ b/src/csharp/Grpc.Core.Tests/TimespecTest.cs @@ -59,6 +59,19 @@ namespace Grpc.Core.Internal.Tests } [Test] + public void ToDateTime() + { + Assert.AreEqual(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc), + new Timespec(IntPtr.Zero, 0).ToDateTime()); + + Assert.AreEqual(new DateTime(1970, 1, 1, 0, 0, 10, DateTimeKind.Utc).AddTicks(50), + new Timespec(new IntPtr(10), 5000).ToDateTime()); + + Assert.AreEqual(new DateTime(2015, 7, 21, 4, 21, 48, DateTimeKind.Utc), + new Timespec(new IntPtr(1437452508), 0).ToDateTime()); + } + + [Test] public void Add() { var t = new Timespec { tv_sec = new IntPtr(12345), tv_nsec = 123456789 }; |