Skip to content

Commit

Permalink
simplify a little
Browse files Browse the repository at this point in the history
  • Loading branch information
l-k- committed Jan 29, 2024
1 parent 76edaf1 commit 998e2d7
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions R/get_starttime_weekday_truncdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,13 @@ get_starttime_weekday_truncdata = function(monc, dformat, data,
wdayname = weekdays[wday]

# assess how much data to delete till next 15 minute period

start_min = starttime$min
start_sec = starttime$sec

secshift = 60 - start_sec # shift in seconds needed
secshift = 60 - starttime$sec # shift in seconds needed
if (secshift != 60) {
start_min = start_min + 1 # shift in minutes needed (+1 one to account for seconds comp)
starttime$min = starttime$min + 1 # shift in minutes needed (+1 one to account for seconds comp)
}
if (secshift == 60) secshift = 0 # if starttime is 00:00 then we do not want to remove data

minshift = start_meas - (start_min %% start_meas)
minshift = start_meas - (starttime$min %% start_meas)
if (minshift == start_meas) {
minshift = 0
}
Expand All @@ -46,7 +42,7 @@ get_starttime_weekday_truncdata = function(monc, dformat, data,
}

# recalculate the timestamp
starttime$min = start_min + minshift # if the result is >= 60, hours (and possibly date) will adjust automatically
starttime$min = starttime$min + minshift # if the result is >= 60, hours (and possibly date) will adjust automatically
starttime$sec = 0

invisible(
Expand Down

0 comments on commit 998e2d7

Please sign in to comment.