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

Last change on this file since 102 was 84, checked in by alloc, 10 years ago

fixes

File size: 649 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 ulong time = this.m_Console.gameManager.World.gameTime;
22 int day = (int)(time / 24000) + 1;
23 int hour = (int)(time % 24000) / 1000 + 8;
24 if (hour > 23) {
25 day++;
26 hour -= 24;
27 }
28 int min = (int)(time % 1000) * 60 / 1000;
29 m_Console.md000a (String.Format ("Day {0}, {1:00}:{2:00} ", day, hour, min));
30 }
31}
32
Note: See TracBrowser for help on using the repository browser.