From 7074c14c8518c883b8344c2d97a37e8c6cf00a8b Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Wed, 6 Dec 2006 11:46:28 +0000 Subject: [PATCH] Use UTC for timestamp on persistent data. --- CASA/micasad/lss/LocalStorage.cs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/CASA/micasad/lss/LocalStorage.cs b/CASA/micasad/lss/LocalStorage.cs index f7103e91..9cf110e1 100644 --- a/CASA/micasad/lss/LocalStorage.cs +++ b/CASA/micasad/lss/LocalStorage.cs @@ -444,7 +444,7 @@ namespace sscs.lss if (createdTimeNode != null) { //Console.WriteLine("Secret create time:" + new DateTime(long.Parse(createdTimeNode.Value))); - secret.CreatedTime = new DateTime(long.Parse(createdTimeNode.Value)); + secret.CreatedTime = new DateTime(long.Parse(createdTimeNode.Value), DateTimeKind.Utc).ToLocalTime(); } else { @@ -455,7 +455,7 @@ namespace sscs.lss if (modifiedTimeNode != null) { //Console.WriteLine("Secret mod time:" + new DateTime(long.Parse(modifiedTimeNode.Value))); - secret.ModifiedTime = new DateTime(long.Parse(modifiedTimeNode.Value)); + secret.ModifiedTime = new DateTime(long.Parse(modifiedTimeNode.Value), DateTimeKind.Utc).ToLocalTime(); } else { @@ -504,8 +504,8 @@ namespace sscs.lss { XmlNode createdTimeNode = timeAttribCol.GetNamedItem(XmlConsts.createdTimeNode); if (createdTimeNode != null) - { - kv.CreatedTime = new DateTime(long.Parse(createdTimeNode.Value)); + { + kv.CreatedTime = new DateTime(long.Parse(createdTimeNode.Value), DateTimeKind.Utc).ToLocalTime(); } else { @@ -514,8 +514,8 @@ namespace sscs.lss XmlNode modifiedTimeNode = timeAttribCol.GetNamedItem(XmlConsts.modifiedTimeNode); if (modifiedTimeNode != null) - { - kv.ModifiedTime = new DateTime(long.Parse(modifiedTimeNode.Value)); + { + kv.ModifiedTime = new DateTime(long.Parse(modifiedTimeNode.Value), DateTimeKind.Utc).ToLocalTime(); } else { @@ -716,8 +716,8 @@ namespace sscs.lss writer.WriteAttributeString(XmlConsts.idAttr, sTmpId); // If we need to store time writer.WriteStartElement(XmlConsts.timeNode); - writer.WriteAttributeString(XmlConsts.createdTimeNode, kc.CreatedTime.Ticks.ToString()); - writer.WriteAttributeString(XmlConsts.modifiedTimeNode, kc.ModifiedTime.Ticks.ToString()); + writer.WriteAttributeString(XmlConsts.createdTimeNode, kc.CreatedTime.ToUniversalTime().Ticks.ToString()); + writer.WriteAttributeString(XmlConsts.modifiedTimeNode, kc.ModifiedTime.ToUniversalTime().Ticks.ToString()); writer.WriteEndElement(); PersistencePol policy = null; @@ -755,9 +755,8 @@ namespace sscs.lss writer.WriteAttributeString(XmlConsts.idAttr, sTmpId); // If we need to store time writer.WriteStartElement(XmlConsts.timeNode); - writer.WriteAttributeString(XmlConsts.createdTimeNode, secret.CreatedTime.Ticks.ToString()); - //writer.WriteAttributeString("LazyTime", secret.CreatedTime.ToShortDateString()); - writer.WriteAttributeString(XmlConsts.modifiedTimeNode, secret.ModifiedTime.Ticks.ToString()); + writer.WriteAttributeString(XmlConsts.createdTimeNode, secret.CreatedTime.ToUniversalTime().Ticks.ToString()); + writer.WriteAttributeString(XmlConsts.modifiedTimeNode, secret.ModifiedTime.ToUniversalTime().Ticks.ToString()); writer.WriteEndElement(); writer.WriteStartElement(XmlConsts.valueNode); @@ -780,8 +779,8 @@ namespace sscs.lss writer.WriteEndElement(); // If we need to store time writer.WriteStartElement(XmlConsts.timeNode); - writer.WriteAttributeString(XmlConsts.createdTimeNode, (secret.GetKeyValueCreatedTime(sKey)).Ticks.ToString()); - writer.WriteAttributeString(XmlConsts.modifiedTimeNode, (secret.GetKeyValueModifiedTime(sKey)).Ticks.ToString()); + writer.WriteAttributeString(XmlConsts.createdTimeNode, (secret.GetKeyValueCreatedTime(sKey)).ToUniversalTime().Ticks.ToString()); + writer.WriteAttributeString(XmlConsts.modifiedTimeNode, (secret.GetKeyValueModifiedTime(sKey)).ToUniversalTime().Ticks.ToString()); writer.WriteEndElement(); // write all LinkKeys