diff --git a/.pubnub.yml b/.pubnub.yml index 926da586e..5a2b7c1a9 100644 --- a/.pubnub.yml +++ b/.pubnub.yml @@ -1,8 +1,13 @@ name: c-sharp -version: "6.19.5" +version: "6.19.6" schema: 1 scm: github.com/pubnub/c-sharp changelog: + - date: 2024-03-28 + version: v6.19.6 + changes: + - type: bug + text: "Fixes issue of inaccurate DateTime to TimeToken conversion in TranslateDateTimeToPubnubUnixNanoSeconds." - date: 2024-01-17 version: v6.19.5 changes: @@ -766,7 +771,7 @@ features: - QUERY-PARAM supported-platforms: - - version: Pubnub 'C#' 6.19.5 + version: Pubnub 'C#' 6.19.6 platforms: - Windows 10 and up - Windows Server 2008 and up @@ -776,7 +781,7 @@ supported-platforms: - .Net Framework 4.5 - .Net Framework 4.6.1+ - - version: PubnubPCL 'C#' 6.19.5 + version: PubnubPCL 'C#' 6.19.6 platforms: - Xamarin.Android - Xamarin.iOS @@ -796,7 +801,7 @@ supported-platforms: - .Net Core - .Net 6.0 - - version: PubnubUWP 'C#' 6.19.5 + version: PubnubUWP 'C#' 6.19.6 platforms: - Windows Phone 10 - Universal Windows Apps @@ -820,7 +825,7 @@ sdks: distribution-type: source distribution-repository: GitHub package-name: Pubnub - location: https://github.com/pubnub/c-sharp/releases/tag/v6.19.5.0 + location: https://github.com/pubnub/c-sharp/releases/tag/v6.19.6.0 requires: - name: ".Net" @@ -1103,7 +1108,7 @@ sdks: distribution-type: source distribution-repository: GitHub package-name: PubNubPCL - location: https://github.com/pubnub/c-sharp/releases/tag/v6.19.5.0 + location: https://github.com/pubnub/c-sharp/releases/tag/v6.19.6.0 requires: - name: ".Net Core" @@ -1462,7 +1467,7 @@ sdks: distribution-type: source distribution-repository: GitHub package-name: PubnubUWP - location: https://github.com/pubnub/c-sharp/releases/tag/v6.19.5.0 + location: https://github.com/pubnub/c-sharp/releases/tag/v6.19.6.0 requires: - name: "Universal Windows Platform Development" diff --git a/CHANGELOG b/CHANGELOG index fab3ca573..4e761d3db 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +v6.19.6 - March 28 2024 +----------------------------- +- Fixed: fixes issue of inaccurate DateTime to TimeToken conversion in TranslateDateTimeToPubnubUnixNanoSeconds. + v6.19.5 - January 17 2024 ----------------------------- - Fixed: fixes issue of getting exception for custom objects in subscription and history when crypto module is configured. diff --git a/src/Api/PubnubApi/EndPoint/OtherOperation.cs b/src/Api/PubnubApi/EndPoint/OtherOperation.cs index f611c11e1..75f6dbf6e 100644 --- a/src/Api/PubnubApi/EndPoint/OtherOperation.cs +++ b/src/Api/PubnubApi/EndPoint/OtherOperation.cs @@ -97,7 +97,7 @@ public static long TranslateDateTimeToSeconds(DateTime dotNetUTCDateTime) public static long TranslateDateTimeToPubnubUnixNanoSeconds(DateTime dotNetUTCDateTime) { TimeSpan timeSpan = dotNetUTCDateTime - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); - long timeStamp = Convert.ToInt64(timeSpan.TotalSeconds) * 10000000; + long timeStamp = Convert.ToInt64(timeSpan.TotalSeconds * 10000000); return timeStamp; } diff --git a/src/Api/PubnubApi/Properties/AssemblyInfo.cs b/src/Api/PubnubApi/Properties/AssemblyInfo.cs index d81275ae0..f163eda0e 100644 --- a/src/Api/PubnubApi/Properties/AssemblyInfo.cs +++ b/src/Api/PubnubApi/Properties/AssemblyInfo.cs @@ -11,8 +11,8 @@ [assembly: AssemblyProduct("Pubnub C# SDK")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("6.19.5.0")] -[assembly: AssemblyFileVersion("6.19.5.0")] +[assembly: AssemblyVersion("6.19.6.0")] +[assembly: AssemblyFileVersion("6.19.6.0")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. diff --git a/src/Api/PubnubApi/PubnubApi.csproj b/src/Api/PubnubApi/PubnubApi.csproj index ce225a246..51aecc4e6 100644 --- a/src/Api/PubnubApi/PubnubApi.csproj +++ b/src/Api/PubnubApi/PubnubApi.csproj @@ -14,7 +14,7 @@ Pubnub - 6.19.5.0 + 6.19.6.0 PubNub C# .NET - Web Data Push API Pandu Masabathula PubNub @@ -22,7 +22,7 @@ http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png true https://github.com/pubnub/c-sharp/ - Fixes issue of getting exception for custom objects in subscription and history when crypto module is configured. + Fixes issue of inaccurate DateTime to TimeToken conversion in TranslateDateTimeToPubnubUnixNanoSeconds. Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously diff --git a/src/Api/PubnubApiPCL/PubnubApiPCL.csproj b/src/Api/PubnubApiPCL/PubnubApiPCL.csproj index 79db825d7..1a0392d55 100644 --- a/src/Api/PubnubApiPCL/PubnubApiPCL.csproj +++ b/src/Api/PubnubApiPCL/PubnubApiPCL.csproj @@ -15,7 +15,7 @@ PubnubPCL - 6.19.5.0 + 6.19.6.0 PubNub C# .NET - Web Data Push API Pandu Masabathula PubNub @@ -23,7 +23,7 @@ http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png true https://github.com/pubnub/c-sharp/ - Fixes issue of getting exception for custom objects in subscription and history when crypto module is configured. + Fixes issue of inaccurate DateTime to TimeToken conversion in TranslateDateTimeToPubnubUnixNanoSeconds. Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously diff --git a/src/Api/PubnubApiUWP/PubnubApiUWP.csproj b/src/Api/PubnubApiUWP/PubnubApiUWP.csproj index 62cf9ccfd..4ef4abe57 100644 --- a/src/Api/PubnubApiUWP/PubnubApiUWP.csproj +++ b/src/Api/PubnubApiUWP/PubnubApiUWP.csproj @@ -16,7 +16,7 @@ PubnubUWP - 6.19.5.0 + 6.19.6.0 PubNub C# .NET - Web Data Push API Pandu Masabathula PubNub @@ -24,7 +24,7 @@ http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png true https://github.com/pubnub/c-sharp/ - Fixes issue of getting exception for custom objects in subscription and history when crypto module is configured. + Fixes issue of inaccurate DateTime to TimeToken conversion in TranslateDateTimeToPubnubUnixNanoSeconds. Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously diff --git a/src/Api/PubnubApiUnity/PubnubApiUnity.csproj b/src/Api/PubnubApiUnity/PubnubApiUnity.csproj index cdbb0611f..38c66e62b 100644 --- a/src/Api/PubnubApiUnity/PubnubApiUnity.csproj +++ b/src/Api/PubnubApiUnity/PubnubApiUnity.csproj @@ -15,7 +15,7 @@ PubnubApiUnity - 6.19.5.0 + 6.19.6.0 PubNub C# .NET - Web Data Push API Pandu Masabathula PubNub diff --git a/src/UnitTests/PubnubApi.Tests/WhenGetRequestServerTime.cs b/src/UnitTests/PubnubApi.Tests/WhenGetRequestServerTime.cs index 91ca7801e..f08bf94ec 100644 --- a/src/UnitTests/PubnubApi.Tests/WhenGetRequestServerTime.cs +++ b/src/UnitTests/PubnubApi.Tests/WhenGetRequestServerTime.cs @@ -285,17 +285,27 @@ public static void ThenWithProxyItShouldReturnTimeStampWithSSL() public static void TranslateDateTimeToUnixTime() { //Test for 26th June 2012 GMT - DateTime dt = new DateTime(2012, 6, 26, 0, 0, 0, DateTimeKind.Utc); + DateTime dt = new DateTime(2012, 6, 26, 21, 37, 13, 37, DateTimeKind.Utc); long nanoSecondTime = Pubnub.TranslateDateTimeToPubnubUnixNanoSeconds(dt); - Assert.True(13406688000000000 == nanoSecondTime); + Assert.True(13407466330370000 == nanoSecondTime); + } + + [Test] + public static void TranslateDateTimeToUnixTimeAndBack() + { + //Test for 26th June 2012 GMT + DateTime expectedDate = new DateTime(2012, 6, 26, 21, 37, 13, 37, DateTimeKind.Utc); + long nanoSecondTime = Pubnub.TranslateDateTimeToPubnubUnixNanoSeconds(expectedDate); + DateTime dateAgain = Pubnub.TranslatePubnubUnixNanoSecondsToDateTime(nanoSecondTime); + Assert.True(expectedDate.Equals(dateAgain)); } [Test] public static void TranslateUnixTimeToDateTime() { //Test for 26th June 2012 GMT - DateTime expectedDate = new DateTime(2012, 6, 26, 0, 0, 0, DateTimeKind.Utc); - DateTime actualDate = Pubnub.TranslatePubnubUnixNanoSecondsToDateTime(13406688000000000); + DateTime expectedDate = new DateTime(2012, 6, 26, 21, 37, 13, 37, DateTimeKind.Utc); + DateTime actualDate = Pubnub.TranslatePubnubUnixNanoSecondsToDateTime(13407466330370000); Assert.True(expectedDate == actualDate); }