Struct UnixTime
- Namespace
- Glitch9
A long value that acts as a DateTime object. (DateTime을 가장한 long 값)
[Serializable]
public struct UnixTime : IComparable<UnixTime>, IEquatable<UnixTime>
- Implements
- Inherited Members
- Extension Methods
Constructors
UnixTime(DateTime, bool)
public UnixTime(DateTime dateTime, bool toUniversalTime = true)
Parameters
UnixTime(int, int, int)
public UnixTime(int year, int month, int day)
Parameters
UnixTime(int, int, int, int, int, int)
public UnixTime(int year, int month, int day, int hour, int minute, int second)
Parameters
UnixTime(long)
public UnixTime(long unixTimestamp)
Parameters
unixTimestamp
long
UnixTime(string)
public UnixTime(string dateAsString)
Parameters
dateAsString
string
Fields
UnixEpoch
public static readonly DateTime UnixEpoch
Field Value
Properties
Date
public readonly UnixTime Date { get; }
Property Value
Day
public readonly int Day { get; }
Property Value
Default
public static UnixTime Default { get; }
Property Value
Empty
public static UnixTime Empty { get; }
Property Value
Hour
public readonly int Hour { get; }
Property Value
IsEmpty
public readonly bool IsEmpty { get; }
Property Value
MaxValue
public static UnixTime MaxValue { get; }
Property Value
MinValue
public static UnixTime MinValue { get; }
Property Value
Minute
public readonly int Minute { get; }
Property Value
Month
public readonly int Month { get; }
Property Value
Now
public static UnixTime Now { get; }
Property Value
Second
public readonly int Second { get; }
Property Value
Today
public static UnixTime Today { get; }
Property Value
Value
public long Value { get; }
Property Value
Year
public readonly int Year { get; }
Property Value
Methods
Add(UnixTime)
public readonly TimeSpan Add(UnixTime b)
Parameters
b
UnixTime
Returns
AddDays(long)
public readonly UnixTime AddDays(long days)
Parameters
days
long
Returns
AddHours(long)
public readonly UnixTime AddHours(long hours)
Parameters
hours
long
Returns
AddMinutes(long)
public readonly UnixTime AddMinutes(long minutes)
Parameters
minutes
long
Returns
AddSeconds(long)
public UnixTime AddSeconds(long seconds)
Parameters
seconds
long
Returns
Compare(UnixTime, UnixTime)
public static int Compare(UnixTime a, UnixTime b)
Parameters
Returns
CompareTo(UnixTime)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public readonly int CompareTo(UnixTime other)
Parameters
other
UnixTimeAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes other
in the sort order.Zero This instance occurs in the same position in the sort order as other
.Greater than zero This instance follows other
in the sort order.
CompareTo(DateTime)
public readonly int CompareTo(DateTime other)
Parameters
other
DateTime
Returns
CompareTo(long)
public readonly int CompareTo(long other)
Parameters
other
long
Returns
Equals(UnixTime)
Indicates whether the current object is equal to another object of the same type.
public readonly bool Equals(UnixTime other)
Parameters
other
UnixTimeAn object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override readonly bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override readonly int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Subtract(UnixTime)
public readonly TimeSpan Subtract(UnixTime b)
Parameters
b
UnixTime
Returns
ToDateTime()
public readonly DateTime ToDateTime()
Returns
ToLocalTime()
public readonly DateTime ToLocalTime()
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
ToString(string)
public readonly string ToString(string format)
Parameters
format
string
Returns
Operators
operator +(UnixTime, UnixTime)
public static TimeSpan operator +(UnixTime a, UnixTime b)
Parameters
Returns
operator ==(UnixTime, UnixTime)
public static bool operator ==(UnixTime a, UnixTime b)
Parameters
Returns
explicit operator DateTime(UnixTime)
public static explicit operator DateTime(UnixTime unixTime)
Parameters
unixTime
UnixTime
Returns
operator >(UnixTime, UnixTime)
public static bool operator >(UnixTime a, UnixTime b)
Parameters
Returns
operator >=(UnixTime, UnixTime)
public static bool operator >=(UnixTime a, UnixTime b)
Parameters
Returns
implicit operator long(UnixTime)
public static implicit operator long(UnixTime unixTime)
Parameters
unixTime
UnixTime
Returns
implicit operator UnixTime(DateTime)
public static implicit operator UnixTime(DateTime dateTime)
Parameters
dateTime
DateTime
Returns
implicit operator UnixTime(long)
public static implicit operator UnixTime(long unixTimestamp)
Parameters
unixTimestamp
long
Returns
operator !=(UnixTime, UnixTime)
public static bool operator !=(UnixTime a, UnixTime b)
Parameters
Returns
operator <(UnixTime, UnixTime)
public static bool operator <(UnixTime a, UnixTime b)
Parameters
Returns
operator <=(UnixTime, UnixTime)
public static bool operator <=(UnixTime a, UnixTime b)
Parameters
Returns
operator -(UnixTime, UnixTime)
public static TimeSpan operator -(UnixTime a, UnixTime b)