mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 18:25:33 +08:00
Add experimental "show grid users online" console command to show grid users online from a standalone/robust instance.
This is not guaranteed to be accurate since users may be left "online" in certain situations. For example, if a simulator crashes and they never login/logout again. To counter this somewhat, only users continuously online for less than 5 days are shown.
This commit is contained in:
@@ -130,7 +130,7 @@ namespace OpenSim.Framework
|
||||
private static SmartThreadPool m_ThreadPool;
|
||||
|
||||
// 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.
|
||||
private static readonly DateTime unixEpoch =
|
||||
public static readonly DateTime UnixEpoch =
|
||||
DateTime.ParseExact("1970-01-01 00:00:00 +0", "yyyy-MM-dd hh:mm:ss z", DateTimeFormatInfo.InvariantInfo).ToUniversalTime();
|
||||
|
||||
private static readonly string rawUUIDPattern
|
||||
@@ -521,19 +521,19 @@ namespace OpenSim.Framework
|
||||
|
||||
public static int ToUnixTime(DateTime stamp)
|
||||
{
|
||||
TimeSpan t = stamp.ToUniversalTime() - unixEpoch;
|
||||
TimeSpan t = stamp.ToUniversalTime() - UnixEpoch;
|
||||
return (int) t.TotalSeconds;
|
||||
}
|
||||
|
||||
public static DateTime ToDateTime(ulong seconds)
|
||||
{
|
||||
DateTime epoch = unixEpoch;
|
||||
DateTime epoch = UnixEpoch;
|
||||
return epoch.AddSeconds(seconds);
|
||||
}
|
||||
|
||||
public static DateTime ToDateTime(int seconds)
|
||||
{
|
||||
DateTime epoch = unixEpoch;
|
||||
DateTime epoch = UnixEpoch;
|
||||
return epoch.AddSeconds(seconds);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user