TimeOfDay

Represents a time of day. This is different from TimeSpan in that each component is represented within the limits of everyday time, rather than from the start of the Epoch. Effectively, the TimeOfDay epoch is the first second of each day.

This is handy for dealing strictly with a 24-hour clock instead of potentially thousands of years. For example:

auto time = Clock.now.time;
assert (time.millis < 1000);
assert (time.seconds < 60);
assert (time.minutes < 60);
assert (time.hours < 24);

You can create a TimeOfDay from an existing Time or TimeSpan instance via the respective time() method. To convert back to a TimeSpan, use the span() method

Members

Functions

span
TimeSpan span()

construct a TimeSpan from the current fields

Static functions

modulo24
TimeSpan modulo24(long ticks)

internal routine to adjust ticks by one day. Also adjusts for offsets in the BC era

opCall
TimeOfDay opCall(uint hours, uint minutes, uint seconds, uint millis)

constructor.

opCall
TimeOfDay opCall(long ticks)
TimeOfDay opCall(Duration dur)

constructor.

Variables

hours
uint hours;

hours component of the time of day. This should be between 0 and 23, inclusive.

millis
uint millis;

milliseconds component of the time of day. This should be between 0 and 999, inclusive.

minutes
uint minutes;

minutes component of the time of day. This should be between 0 and 59, inclusive.

seconds
uint seconds;

seconds component of the time of day. This should be between 0 and 59, inclusive.

Meta