dragosmg commented on a change in pull request #12506:
URL: https://github.com/apache/arrow/pull/12506#discussion_r827147768



##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -189,6 +189,70 @@ register_bindings_datetime <- function() {
   })
 }
 
+register_bindings_duration <- function() {
+  register_binding("difftime", function(time1,
+                                        time2,
+                                        tz,
+                                        units = c("auto", "secs", "mins",
+                                                  "hours", "days", "weeks")) {
+    units <- match.arg(units)
+    if (units != "secs") {
+      abort("`difftime()` with units other than seconds not supported in 
Arrow")
+    }
+
+    # for time32() we do not need to worry about timezone
+    if (call_binding("is.instant", time1) & call_binding("is.instant", time2)) 
{

Review comment:
       For some reason (I don't remember exactly why, but it's linked to the 
`time32()` comment) I wanted to split the logic into time types (`time32` & 
`time64`) vs date types (`date32` and `date64`) + timestamp. Hence the use of 
`is.instant`, which I think does what I was after, but not quite remember the 
_why_. At that moment I thought the comment was good enough. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to