Class TimeUtility
Time Related Utility Methods.
Inheritance
System.Object
TimeUtility
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: StansAssets.Foundation
Assembly: cs.temp.dll.dll
Syntax
public static class TimeUtility
Methods
FromUnixTime(Int64)
Converts a UNIX time stamp into System.DateTime object.
Declaration
public static DateTime FromUnixTime(long timestamp)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | timestamp | UNIX timestamp. |
Returns
Type | Description |
---|---|
System.DateTime |
GetTime(String)
Get timer value in seconds by timer name. You may star any number of timers using the StartTimer(String) method.
If timer with specified name doesn't exist 0
value will be returned.
Declaration
public static float GetTime(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the timer. |
Returns
Type | Description |
---|---|
System.Single | Timer value in seconds |
HasTimer(String)
Method allows if time with specified name exists.
Declaration
public static bool HasTimer(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the timer. |
Returns
Type | Description |
---|---|
System.Boolean |
|
RemoveTimer(String)
Removes timer from timers list.
Declaration
public static void RemoveTimer(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the timer. |
StartTimer(String)
Start new timer, with given name. You can check timer second value via GetTime(String) method.
Declaration
public static void StartTimer(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the timer. |
ToUnixTime(DateTime)
Gets a UNIX timestamp from a System.DateTime object.
Declaration
public static long ToUnixTime(DateTime date)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | date | Source date for conversion. |
Returns
Type | Description |
---|---|
System.Int64 |