diff --git a/R/in_range.R b/R/in_range.R index 368be5cd57ee826de75e0bf903ebd625e8c8987a..2ca32687fa7af708d2d4026a3b922af20eb29a33 100644 --- a/R/in_range.R +++ b/R/in_range.R @@ -19,6 +19,7 @@ #' @param tstart The start of the period. #' @param time The timestamps as POSIX. #' @param tend The end of the period. If not given then the period will have no end. +#' @param timezone The timezone of the timestamps, time. #' @return A logical vector indicating the selected period with TRUE #' @name in_range #' @examples @@ -46,12 +47,16 @@ #' #' @export -in_range <- function(tstart, time, tend=NA) { +in_range <- function(tstart, time, tend=NA, timezone=NA) { if (class(tstart)[1] == "character") tstart <- ct(tstart) if (is.na(tend)) tend <- time[length(time)] if (class(tend)[1] == "character") tend <- ct(tend) - ct(tstart) < time & time <= ct(tend) + if (is.na(timezone)){ + timezone <- attr(D$t, "tzone") + } + + ct(tstart, tz = timezone) < time & time <= ct(tend, tz = timezone) } diff --git a/testfile.txt b/testfile.txt deleted file mode 100644 index 0a901256855d2d1b72f4587455661f1577bf8a5e..0000000000000000000000000000000000000000 --- a/testfile.txt +++ /dev/null @@ -1 +0,0 @@ -Testing \ No newline at end of file