I am getting data from some sensors that record values in their respective (local) timezone. The timestamps do not indicate what timezone the sensor is in. I'm calling googleway::google_timezone()
to use the Google timezone API and get the timezone corresponding to the geoggraphical location of the sensors.
The output is as below (example):
google_timezone(latlon, key = mykey)
$dstOffset
[1] 0
$rawOffset
[1] -18000
$status
[1] "OK"
$timeZoneId
[1] "America/Toronto"
$timeZoneName
[1] "Eastern Standard Time"
The dstOffset
field is 0 which seems to be incorrect (location is in Eastern Canada with daylight savings). I need to save the data in UTC on a server. Using attr
to convert from the local timezone to UTC fails to address the daylight savings issue - the time difference remains constant regardless of the time of the year. For N. America, the time difference should change by 1 hour during the year on account of daylight savings. I've read the answers for Daylight saving time and time zone best practices and https://stackoverflow.com/tags/timezone/info which seem to suggest that this information (daylight savings) is somehow contained in the "timezone".
Is there any other way to do this?