Time

Represents a point in time.

Remarks: Time represents dates and times between 12:00:00 midnight on January 1, 10000 BC and 11:59:59 PM on December 31, 9999 AD.

Time values are measured in 100-nanosecond intervals, or ticks. A date value is the number of ticks that have elapsed since 12:00:00 midnight on January 1, 0001 AD in the Gregorian calendar.

Negative Time values are offsets from that same reference point, but backwards in history. Time values are not specific to any calendar, but for an example, the beginning of December 31, 1 BC in the Gregorian calendar is Time.epoch - TimeSpan.days(1).

Members

Functions

date
Time date()

Property. Retrieves the date component.

opBinary
Time opBinary(TimeSpan t)

Adds or subtracts the specified time span to the time, returning a new time.

opBinary
TimeSpan opBinary(Time t)

Returns a time span which represents the difference in time between this and the given Time.

opCmp
int opCmp(Time t)

Compares two Time values.

opEquals
int opEquals(Time t)

Determines whether two Time values are equal.

opOpAssign
Time opOpAssign(TimeSpan t)

Adds or subtracts the specified time span to the time, assigning the result to this instance.

span
TimeSpan span()

Property. Retrieves the equivalent TimeSpan.

ticks
long ticks()

Property. Retrieves the number of ticks for this Time. This value can be used to construct another Time struct by writing:

time
TimeOfDay time()

Property. Retrieves the time of day.

unix
TimeSpan unix()

Property. Retrieves a TimeSpan that corresponds to Unix time (time since 1/1/1970). Use the TimeSpan accessors to get the time in seconds, milliseconds, etc.

Static functions

fromUnixTime
Time fromUnixTime(time_t unix_time)

Constructs a Time instance from the Unix time (time since 1/1/1970).

Variables

epoch
enum Time epoch;

Represents the epoch (1/1/0001)

epoch1601
enum Time epoch1601;

Represents the epoch of 1/1/1601 (Commonly used in Windows systems)

epoch1970
enum Time epoch1970;

Represents the epoch of 1/1/1970 (Commonly used in Unix systems)

max
enum Time max;

Represents the smallest and largest Time value.

min
enum Time min;

Represents the smallest and largest Time value.

Meta