minor simplification of some unix date functions in Util. No functional change.

varregion
Justin Clark-Casey (justincc) 2013-09-03 00:17:50 +01:00
parent 5f15ee95dc
commit 431156f6c4
1 changed files with 3 additions and 5 deletions

View File

@ -522,19 +522,17 @@ namespace OpenSim.Framework
public static int ToUnixTime(DateTime stamp) public static int ToUnixTime(DateTime stamp)
{ {
TimeSpan t = stamp.ToUniversalTime() - UnixEpoch; TimeSpan t = stamp.ToUniversalTime() - UnixEpoch;
return (int) t.TotalSeconds; return (int)t.TotalSeconds;
} }
public static DateTime ToDateTime(ulong seconds) public static DateTime ToDateTime(ulong seconds)
{ {
DateTime epoch = UnixEpoch; return UnixEpoch.AddSeconds(seconds);
return epoch.AddSeconds(seconds);
} }
public static DateTime ToDateTime(int seconds) public static DateTime ToDateTime(int seconds)
{ {
DateTime epoch = UnixEpoch; return UnixEpoch.AddSeconds(seconds);
return epoch.AddSeconds(seconds);
} }
/// <summary> /// <summary>