cmpTimeUnits

Compares two time unit strings. "years" are the largest units and "hnsecs" are the smallest.

@safe pure
int
cmpTimeUnits
(
string lhs
,
string rhs
)

Return Value

Type: int
this < rhs< 0
this == rhs0
this > rhs> 0

Throws

DateTimeException if either of the given strings is not a valid time unit string.

Examples

import std.exception : assertThrown;

assert(cmpTimeUnits("hours", "hours") == 0);
assert(cmpTimeUnits("hours", "weeks") < 0);
assert(cmpTimeUnits("months", "seconds") > 0);

assertThrown!DateTimeException(cmpTimeUnits("month", "second"));

Meta