diff options
author | Teravus Ovares | 2008-03-03 08:30:36 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-03-03 08:30:36 +0000 |
commit | fe49c96ee0db0974a91b9b175ac1b00aef035797 (patch) | |
tree | 27fb1de9eea228d2e89e1c5b1c83cca8577b3bd9 /OpenSim/Framework/Util.cs | |
parent | * Doh, forgot one license header (diff) | |
download | opensim-SC-fe49c96ee0db0974a91b9b175ac1b00aef035797.zip opensim-SC-fe49c96ee0db0974a91b9b175ac1b00aef035797.tar.gz opensim-SC-fe49c96ee0db0974a91b9b175ac1b00aef035797.tar.bz2 opensim-SC-fe49c96ee0db0974a91b9b175ac1b00aef035797.tar.xz |
* Applying Ahzz's profile patch. Thanks Ahzz!
* Fixed a few bugs in the patch that are sim crashers.
* There's still a bug in mySQL mode/ grid mode where the main userprofile text doesn't save.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Util.cs | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 856cac3..35e795b 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -181,9 +181,25 @@ namespace OpenSim.Framework | |||
181 | 181 | ||
182 | public static int UnixTimeSinceEpoch() | 182 | public static int UnixTimeSinceEpoch() |
183 | { | 183 | { |
184 | TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); | 184 | return ToUnixTime(DateTime.UtcNow); |
185 | int timestamp = (int) t.TotalSeconds; | 185 | } |
186 | return timestamp; | 186 | |
187 | public static int ToUnixTime(DateTime stamp) | ||
188 | { | ||
189 | TimeSpan t = (stamp.ToUniversalTime() - Convert.ToDateTime("1/1/1970 8:00:00 AM")); | ||
190 | return (int)t.TotalSeconds; | ||
191 | } | ||
192 | |||
193 | public static DateTime ToDateTime(ulong seconds) | ||
194 | { | ||
195 | DateTime epoch = Convert.ToDateTime("1/1/1970 8:00:00 AM"); | ||
196 | return epoch.AddSeconds(seconds); | ||
197 | } | ||
198 | |||
199 | public static DateTime ToDateTime(int seconds) | ||
200 | { | ||
201 | DateTime epoch = Convert.ToDateTime("1/1/1970 8:00:00 AM"); | ||
202 | return epoch.AddSeconds(seconds); | ||
187 | } | 203 | } |
188 | 204 | ||
189 | public static string Md5Hash(string pass) | 205 | public static string Md5Hash(string pass) |