Use UTC for timestamp on persistent data.

This commit is contained in:
Jim Norman 2006-12-06 11:46:28 +00:00
parent 6fe32f742c
commit 7074c14c85

View File

@ -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