diff --git a/R/hms.R b/R/hms.R index c57e356..f83fb5e 100644 --- a/R/hms.R +++ b/R/hms.R @@ -274,3 +274,18 @@ print.hms <- function(x, ...) { cat(format(x), sep = "\n") invisible(x) } + +# Operations -------------------------------------------------------------- + +#' @export +Ops.hms <- function (e1, e2) { + boolean <- switch(.Generic, `<` = , `>` = , `==` = , `!=` = , + `<=` = , `>=` = TRUE, FALSE) + if (boolean) { + if (inherits(e1, "hms") & inherits(e2, "character")) + e1 <- as.character(e1) + if (inherits(e2, "hms") & inherits(e1, "character")) + e2 <- as.character(e2) + } + NextMethod(.Generic) +}