diff options
author | Melanie | 2013-09-07 13:54:19 +0100 |
---|---|---|
committer | Melanie | 2013-09-07 13:54:19 +0100 |
commit | 2f365ea80be0df545a74da03afceb964da1546d1 (patch) | |
tree | a54202b1cdabaa201c0566232bde69cecdcfef6a /OpenSim/Framework/Util.cs | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-2f365ea80be0df545a74da03afceb964da1546d1.zip opensim-SC-2f365ea80be0df545a74da03afceb964da1546d1.tar.gz opensim-SC-2f365ea80be0df545a74da03afceb964da1546d1.tar.bz2 opensim-SC-2f365ea80be0df545a74da03afceb964da1546d1.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 7398b37..7db575b 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -130,7 +130,7 @@ namespace OpenSim.Framework | |||
130 | private static SmartThreadPool m_ThreadPool; | 130 | private static SmartThreadPool m_ThreadPool; |
131 | 131 | ||
132 | // 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. | 132 | // 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. |
133 | private static readonly DateTime unixEpoch = | 133 | public static readonly DateTime UnixEpoch = |
134 | DateTime.ParseExact("1970-01-01 00:00:00 +0", "yyyy-MM-dd hh:mm:ss z", DateTimeFormatInfo.InvariantInfo).ToUniversalTime(); | 134 | DateTime.ParseExact("1970-01-01 00:00:00 +0", "yyyy-MM-dd hh:mm:ss z", DateTimeFormatInfo.InvariantInfo).ToUniversalTime(); |
135 | 135 | ||
136 | private static readonly string rawUUIDPattern | 136 | private static readonly string rawUUIDPattern |
@@ -521,20 +521,18 @@ namespace OpenSim.Framework | |||
521 | 521 | ||
522 | public static int ToUnixTime(DateTime stamp) | 522 | public static int ToUnixTime(DateTime stamp) |
523 | { | 523 | { |
524 | TimeSpan t = stamp.ToUniversalTime() - unixEpoch; | 524 | TimeSpan t = stamp.ToUniversalTime() - UnixEpoch; |
525 | return (int) t.TotalSeconds; | 525 | return (int)t.TotalSeconds; |
526 | } | 526 | } |
527 | 527 | ||
528 | public static DateTime ToDateTime(ulong seconds) | 528 | public static DateTime ToDateTime(ulong seconds) |
529 | { | 529 | { |
530 | DateTime epoch = unixEpoch; | 530 | return UnixEpoch.AddSeconds(seconds); |
531 | return epoch.AddSeconds(seconds); | ||
532 | } | 531 | } |
533 | 532 | ||
534 | public static DateTime ToDateTime(int seconds) | 533 | public static DateTime ToDateTime(int seconds) |
535 | { | 534 | { |
536 | DateTime epoch = unixEpoch; | 535 | return UnixEpoch.AddSeconds(seconds); |
537 | return epoch.AddSeconds(seconds); | ||
538 | } | 536 | } |
539 | 537 | ||
540 | /// <summary> | 538 | /// <summary> |