LIBOMV-460 LIBOMV-423 BinaryLLSD Unit Tests Failing, this appears to be caused by an Endian issue

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2506 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
Jim Radford
2009-03-19 17:19:23 +00:00
parent b418d85e00
commit fb6376d2b6
3 changed files with 17 additions and 2 deletions

View File

@@ -627,7 +627,13 @@ namespace OpenMetaverse.StructuredData
public override byte[] AsBinary()
{
TimeSpan ts = value.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
return Utils.DoubleToBytes(ts.TotalSeconds);
byte[] bytes = Utils.DoubleToBytes(ts.TotalSeconds);
if (BitConverter.IsLittleEndian)
Array.Reverse(bytes);
return bytes;
}
public override DateTime AsDate() { return value; }