Show / Hide Table of Contents

Class UnixTime

Represents a point in time as the number of seconds since the Unix epoch (Unix timestamp).

Inheritance
Object
UnixTime
Namespace: NanoByte.Common
Assembly: NanoByte.Common.dll
Syntax
public sealed class UnixTime : ValueType

Constructors

UnixTime(Int64)

Represents a point in time as the number of seconds since the Unix epoch (Unix timestamp).

Declaration
public UnixTime(long Seconds)
Parameters
Type Name Description
Int64 Seconds

The number of seconds since the Unix epoch (00:00:00 UTC on 1 January 1970).

Properties

Seconds

The number of seconds since the Unix epoch (00:00:00 UTC on 1 January 1970).

Declaration
public long Seconds { get; set; }
Property Value
Type Description
Int64

Methods

CompareTo(UnixTime)

Declaration
public int CompareTo(UnixTime other)
Parameters
Type Name Description
UnixTime other
Returns
Type Description
Int32

Deconstruct(out Int64)

Declaration
public void Deconstruct(out long Seconds)
Parameters
Type Name Description
Int64 Seconds

Equals(UnixTime)

Declaration
public bool Equals(UnixTime other)
Parameters
Type Name Description
UnixTime other
Returns
Type Description
Boolean

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
Object obj
Returns
Type Description
Boolean

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
Int32

GetObjectData(SerializationInfo, StreamingContext)

Declaration
public void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type Name Description
SerializationInfo info
StreamingContext context

ToString()

Declaration
public override string ToString()
Returns
Type Description
String

Operators

Equality(UnixTime, UnixTime)

Declaration
public static bool operator ==(UnixTime left, UnixTime right)
Parameters
Type Name Description
UnixTime left
UnixTime right
Returns
Type Description
Boolean

Implicit(UnixTime to DateTime)

Converts a Unix timestamp to a DateTime.

Declaration
public static implicit operator DateTime(UnixTime timestamp)
Parameters
Type Name Description
UnixTime timestamp
Returns
Type Description
DateTime

Implicit(UnixTime to DateTimeOffset)

Converts a Unix timestamp to a DateTimeOffset.

Declaration
public static implicit operator DateTimeOffset(UnixTime timestamp)
Parameters
Type Name Description
UnixTime timestamp
Returns
Type Description
DateTimeOffset

Implicit(UnixTime to Int64)

Converts a Unix timestamp to a number of seconds.

Declaration
public static implicit operator long (UnixTime timestamp)
Parameters
Type Name Description
UnixTime timestamp
Returns
Type Description
Int64

Implicit(DateTime to UnixTime)

Converts a number of dateTime to a Unix timestamp.

Declaration
public static implicit operator UnixTime(DateTime dateTime)
Parameters
Type Name Description
DateTime dateTime
Returns
Type Description
UnixTime

Implicit(DateTimeOffset to UnixTime)

Converts a number of dateTime to a Unix timestamp.

Declaration
public static implicit operator UnixTime(DateTimeOffset dateTime)
Parameters
Type Name Description
DateTimeOffset dateTime
Returns
Type Description
UnixTime

Implicit(Int64 to UnixTime)

Converts a number of seconds to a Unix timestamp.

Declaration
public static implicit operator UnixTime(long seconds)
Parameters
Type Name Description
Int64 seconds
Returns
Type Description
UnixTime

Inequality(UnixTime, UnixTime)

Declaration
public static bool operator !=(UnixTime left, UnixTime right)
Parameters
Type Name Description
UnixTime left
UnixTime right
Returns
Type Description
Boolean

Extension Methods

UpdateUtils.To<TIn, TOut>(TIn, Func<TIn, TOut>)
JsonStorage.SaveJson<T>(T, Stream)
JsonStorage.SaveJson<T>(T, String)
JsonStorage.ToJsonString<T>(T)
JsonStorage.ReparseAsJson<T>(Object)
JsonStorage.ReparseAsJson<T>(Object, T)
XmlStorage.SaveXml(Object, Stream, String)
XmlStorage.SaveXml<T>(T, String, String)
XmlStorage.ToXmlString(Object, String)
ConversionUtils.ConvertToString<TType>(TType)
In This Article
Back to top Copyright Bastian Eicher