NanoByte.Common  2.10.5
NanoByte.Common.UnixTime Struct Reference

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

Inheritance diagram for NanoByte.Common.UnixTime:

Public Member Functions

 UnixTime (long seconds)
 Creates a new Unix timestamp. More...
 
void GetObjectData (SerializationInfo info, StreamingContext context)
 
int CompareTo (UnixTime other)
 
bool Equals (UnixTime other)
 
override bool Equals (object? obj)
 
override int GetHashCode ()
 
override string ToString ()
 

Static Public Member Functions

static implicit operator UnixTime (long seconds)
 Converts a number of seconds to a Unix timestamp. More...
 
static implicit operator long (UnixTime timestamp)
 Converts a Unix timestamp to a number of seconds. More...
 
static implicit operator UnixTime (DateTime dateTime)
 Converts a number of dateTime to a Unix timestamp. More...
 
static implicit operator DateTime (UnixTime timestamp)
 Converts a Unix timestamp to a DateTime. More...
 
static implicit operator UnixTime (DateTimeOffset dateTime)
 Converts a number of dateTime to a Unix timestamp. More...
 
static implicit operator DateTimeOffset (UnixTime timestamp)
 Converts a Unix timestamp to a DateTimeOffset. More...
 
static bool operator== (UnixTime t1, UnixTime t2)
 
static bool operator!= (UnixTime t1, UnixTime t2)
 

Properties

long Seconds [get]
 The number of seconds since the Unix epoch (00:00:00 UTC on 1 January 1970). More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ UnixTime()

NanoByte.Common.UnixTime.UnixTime ( long  seconds)
inline

Creates a new Unix timestamp.

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

Member Function Documentation

◆ operator DateTime()

static implicit NanoByte.Common.UnixTime.operator DateTime ( UnixTime  timestamp)
static

Converts a Unix timestamp to a DateTime.

◆ operator DateTimeOffset()

static implicit NanoByte.Common.UnixTime.operator DateTimeOffset ( UnixTime  timestamp)
static

Converts a Unix timestamp to a DateTimeOffset.

◆ operator long()

static implicit NanoByte.Common.UnixTime.operator long ( UnixTime  timestamp)
static

Converts a Unix timestamp to a number of seconds.

◆ operator UnixTime() [1/3]

static implicit NanoByte.Common.UnixTime.operator UnixTime ( DateTime  dateTime)
inlinestatic

Converts a number of dateTime to a Unix timestamp.

◆ operator UnixTime() [2/3]

static implicit NanoByte.Common.UnixTime.operator UnixTime ( DateTimeOffset  dateTime)
static

Converts a number of dateTime to a Unix timestamp.

◆ operator UnixTime() [3/3]

static implicit NanoByte.Common.UnixTime.operator UnixTime ( long  seconds)
static

Converts a number of seconds to a Unix timestamp.

Property Documentation

◆ Seconds

long NanoByte.Common.UnixTime.Seconds
get

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


The documentation for this struct was generated from the following file: