source: binary-improvements/7dtd-server-fixes/src/TelnetCommands/GetTime.cs@ 127

Last change on this file since 127 was 107, checked in by alloc, 10 years ago

fixes

File size: 743 bytes
Line 
1using System;
2
3public class GetTime : ConsoleCommand
4{
5 public GetTime (ConsoleSdtd cons) : base(cons)
6 {
7 }
8
9 public override string Description ()
10 {
11 return "retrieves current ingame time";
12 }
13
14 public override string[] Names ()
15 {
16 return new string[] { "gettime", "gt" };
17 }
18
19 public override void Run (string[] _params)
20 {
21 try {
22 ulong time = this.m_Console.gameManager.World.gameTime;
23 int day = (int)(time / 24000) + 1;
24 int hour = (int)(time % 24000) / 1000 + 8;
25 if (hour > 23) {
26 day++;
27 hour -= 24;
28 }
29 int min = (int)(time % 1000) * 60 / 1000;
30 m_Console.SendResult (String.Format ("Day {0}, {1:00}:{2:00} ", day, hour, min));
31 } catch (Exception e) {
32 Log.Out ("Error in GetTime.Run: " + e);
33 }
34 }
35}
36
Note: See TracBrowser for help on using the repository browser.