[smuxi: 2/3] Engine: fixed storing last seen message / highlight correctly with smuxi-servers (closes: #1058)
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi: 2/3] Engine: fixed storing last seen message / highlight correctly with smuxi-servers (closes: #1058)
- Date: Sat, 13 Jun 2015 00:30:44 +0000 (UTC)
commit bff11a093e0e57184a54ee0860aa586036dd2746
Author: Mirco Bauer <meebey meebey net>
Date: Sat Jun 13 02:03:38 2015 +0200
Engine: fixed storing last seen message / highlight correctly with smuxi-servers (closes: #1058)
On Mono the DateTimeKind gets lost during serialization of .NET remoting. When
this happens we store the timestamp in local time instead. Otherwise the
timezone offset will be applied _again_ leading to incorrect values.
src/Engine/MessageBuffers/SqliteMessageBuffer.cs | 24 ++++++++++++++++++++-
1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/Engine/MessageBuffers/SqliteMessageBuffer.cs
b/src/Engine/MessageBuffers/SqliteMessageBuffer.cs
index 1f26cc4..1e77e6a 100644
--- a/src/Engine/MessageBuffers/SqliteMessageBuffer.cs
+++ b/src/Engine/MessageBuffers/SqliteMessageBuffer.cs
@@ -76,7 +76,17 @@ namespace Smuxi.Engine
cmd.CommandText = sql;
var param = cmd.CreateParameter();
param.ParameterName = "timestamp";
- param.Value = value.ToUniversalTime().ToString("o");
+ if (value.Kind == DateTimeKind.Unspecified) {
+ // HACK: on Mono the DateTimeKind gets lost during
+ // serialization of .NET remoting. When this happens we
+ // store the timestamp in local time instead. Otherwise
+ // the timezone offset will be applied _again_ leading
+ // to incorrect values, see:
+ // https://smuxi.im/issues/show/1058
+ param.Value = value.ToString("o");
+ } else {
+ param.Value = value.ToUniversalTime().ToString("o");
+ }
cmd.Parameters.Add(param);
cmd.ExecuteNonQuery();
}
@@ -109,7 +119,17 @@ namespace Smuxi.Engine
cmd.CommandText = sql;
var param = cmd.CreateParameter();
param.ParameterName = "timestamp";
- param.Value = value.ToUniversalTime().ToString("o");
+ if (value.Kind == DateTimeKind.Unspecified) {
+ // HACK: on Mono the DateTimeKind gets lost during
+ // serialization of .NET remoting. When this happens we
+ // store the timestamp in local time instead. Otherwise
+ // the timezone offset will be applied _again_ leading
+ // to incorrect values, see:
+ // https://smuxi.im/issues/show/1058
+ param.Value = value.ToString("o");
+ } else {
+ param.Value = value.ToUniversalTime().ToString("o");
+ }
cmd.Parameters.Add(param);
cmd.ExecuteNonQuery();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]