I do not have much experience on handling datatime data. However, my understanding is that as.POSIXct()
will convert the time to unix time based on the time zone of the local computer (same as Sys.timezone()
). Thus the output time in my computer is in CST (UTC+8), yet not local UK time (UTC+0) and the stop message looks misleading to me.
Would it be better to require users to input the timezone? We could still, by default, assume the area of analysis is in the same time zone with the computer. (Would it also be better to use the lubridate package to handle time?)
departing_unix_time <- as.numeric(ymd_hms(departing, tz = Sys.timezone()))
departure_time <- paste0("&departure_time=", departing_unix_time , "&traffic_model=", model))