Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions SlackAPI/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;

namespace SlackAPI
Expand All @@ -17,10 +18,10 @@ public static string ToProperTimeStamp(this DateTime that, bool toUTC = true)
{
if (toUTC)
{
return ((that.ToUniversalTime().Ticks - 621355968000000000m) / 10000000m).ToString("F6");
return ((that.ToUniversalTime().Ticks - 621355968000000000m) / 10000000m).ToString("F6", CultureInfo.InvariantCulture);
}
else
return that.Subtract(new DateTime(1970, 1, 1)).TotalSeconds.ToString();
return that.Subtract(new DateTime(1970, 1, 1)).TotalSeconds.ToString(CultureInfo.InvariantCulture);
}

public static K Deserialize<K>(this string data)
Expand Down
2 changes: 1 addition & 1 deletion SlackAPI/JavascriptDateTimeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public override object ReadJson(Newtonsoft.Json.JsonReader reader, Type objectTy
DateTime res = new DateTime(621355968000000000 + (long)(value * 10000000m)).ToLocalTime();
System.Diagnostics.Debug.Assert(
Decimal.Equals(
Decimal.Parse(res.ToProperTimeStamp()),
Decimal.Parse(res.ToProperTimeStamp(), CultureInfo.InvariantCulture),
Decimal.Parse(reader.Value.ToString(), CultureInfo.InvariantCulture)),
"Precision loss :(");
return res;
Expand Down