diff --git a/Sources/kasthack.vksharp/Internal/Converters/UnixTimeConverter.cs b/Sources/kasthack.vksharp/Internal/Converters/UnixTimeConverter.cs index 302ea72..860f246 100644 --- a/Sources/kasthack.vksharp/Internal/Converters/UnixTimeConverter.cs +++ b/Sources/kasthack.vksharp/Internal/Converters/UnixTimeConverter.cs @@ -32,7 +32,7 @@ public override object ReadJson( JsonReader reader, Type objectType, object exis var jsonValue = serializer.Deserialize(reader); switch ( jsonValue.Type ) { case JTokenType.Integer: - var dto = DateTimeOffset.FromUnixTimeSeconds( jsonValue.Value() ); + var dto = DateTimeOffsetHelper.FromUnixTimeSeconds( jsonValue.Value() ); if ( objectType == DateTimeOffsetType || ( objectType.IsNullable() && Nullable.GetUnderlyingType( objectType ) == DateTimeOffsetType ) ) return dto; return dto.LocalDateTime; diff --git a/Sources/kasthack.vksharp/Internal/DateTimeOffsetHelper.cs b/Sources/kasthack.vksharp/Internal/DateTimeOffsetHelper.cs new file mode 100644 index 0000000..f6a4c49 --- /dev/null +++ b/Sources/kasthack.vksharp/Internal/DateTimeOffsetHelper.cs @@ -0,0 +1,17 @@ +using System; + +namespace kasthack.vksharp.Internal { + public static class DateTimeOffsetHelper { + + private static readonly DateTimeOffset sTime = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); + + public static int ToUnixTimeSeconds(this DateTimeOffset offset) { + return (int) (offset - sTime).TotalSeconds; + } + + public static DateTimeOffset FromUnixTimeSeconds(long seconds) { + return sTime.AddSeconds(seconds); + } + + } +} diff --git a/Sources/kasthack.vksharp/Properties/AssemblyInfo.cs b/Sources/kasthack.vksharp/Properties/AssemblyInfo.cs index c526cb5..36af47f 100644 --- a/Sources/kasthack.vksharp/Properties/AssemblyInfo.cs +++ b/Sources/kasthack.vksharp/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.6.1.*")] +[assembly: AssemblyVersion("0.6.3.*")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Sources/kasthack.vksharp/kasthack.vksharp.csproj b/Sources/kasthack.vksharp/kasthack.vksharp.csproj index a1bca49..3499a26 100644 --- a/Sources/kasthack.vksharp/kasthack.vksharp.csproj +++ b/Sources/kasthack.vksharp/kasthack.vksharp.csproj @@ -9,8 +9,9 @@ Properties kasthack.vksharp kasthack.vksharp - v4.6 + v4.5 512 + true @@ -215,6 +216,7 @@ + @@ -228,8 +230,8 @@ - - + + Designer