diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/Capabilities/Caps.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 11 |
2 files changed, 9 insertions, 3 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index fd43e89..28e56da 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -754,6 +754,7 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
754 | item.BasePermissions = 2147483647; | 754 | item.BasePermissions = 2147483647; |
755 | item.EveryOnePermissions = 0; | 755 | item.EveryOnePermissions = 0; |
756 | item.NextPermissions = 2147483647; | 756 | item.NextPermissions = 2147483647; |
757 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
757 | 758 | ||
758 | if (AddNewInventoryItem != null) | 759 | if (AddNewInventoryItem != null) |
759 | { | 760 | { |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 0f0aa47..c5334a8 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Data; | 29 | using System.Data; |
30 | using System.Globalization; | ||
30 | using System.IO; | 31 | using System.IO; |
31 | using System.IO.Compression; | 32 | using System.IO.Compression; |
32 | using System.Net; | 33 | using System.Net; |
@@ -59,6 +60,10 @@ namespace OpenSim.Framework | |||
59 | private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]"; | 60 | private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]"; |
60 | private static object XferLock = new object(); | 61 | private static object XferLock = new object(); |
61 | 62 | ||
63 | // Unix-epoch starts at January 1st 1970, 00:00:00 UTC. And all our times in the server are (or at least should be) in UTC. | ||
64 | private static readonly DateTime unixEpoch = | ||
65 | DateTime.ParseExact("1970-01-01 00:00:00 +0", "yyyy-MM-dd hh:mm:ss z", DateTimeFormatInfo.InvariantInfo).ToUniversalTime(); | ||
66 | |||
62 | #region Vector Equations | 67 | #region Vector Equations |
63 | 68 | ||
64 | /// <summary> | 69 | /// <summary> |
@@ -290,19 +295,19 @@ namespace OpenSim.Framework | |||
290 | 295 | ||
291 | public static int ToUnixTime(DateTime stamp) | 296 | public static int ToUnixTime(DateTime stamp) |
292 | { | 297 | { |
293 | TimeSpan t = (stamp.ToUniversalTime() - Convert.ToDateTime("1/1/1970 8:00:00 AM")); | 298 | TimeSpan t = stamp.ToUniversalTime() - unixEpoch; |
294 | return (int) t.TotalSeconds; | 299 | return (int) t.TotalSeconds; |
295 | } | 300 | } |
296 | 301 | ||
297 | public static DateTime ToDateTime(ulong seconds) | 302 | public static DateTime ToDateTime(ulong seconds) |
298 | { | 303 | { |
299 | DateTime epoch = Convert.ToDateTime("1/1/1970 8:00:00 AM"); | 304 | DateTime epoch = unixEpoch; |
300 | return epoch.AddSeconds(seconds); | 305 | return epoch.AddSeconds(seconds); |
301 | } | 306 | } |
302 | 307 | ||
303 | public static DateTime ToDateTime(int seconds) | 308 | public static DateTime ToDateTime(int seconds) |
304 | { | 309 | { |
305 | DateTime epoch = Convert.ToDateTime("1/1/1970 8:00:00 AM"); | 310 | DateTime epoch = unixEpoch; |
306 | return epoch.AddSeconds(seconds); | 311 | return epoch.AddSeconds(seconds); |
307 | } | 312 | } |
308 | 313 | ||