Skip to contents

[Experimental]

This function looks for a Timezone table in a local m-Path Sense SQLite database and uses it to assign timezone values to all other sensor tables. For each observation in a sensor table, it finds the timezone interval that matches the observation's timestamp and adds or updates a timezone column accordingly.

Usage

add_timezones_to_db(db, sensors = NULL, .progress = TRUE)

Arguments

db

A database connection, typically created by open_db().

sensors

A character vector of sensor table names to update. Defaults to NULL for all supported sensors.

.progress

Logical; whether to show a progress bar during processing. Defaults to TRUE.

Value

Invisibly returns TRUE if all updates complete successfully.

Details

Note that rerunning this function overwrites existing timezone columns in the sensor tables. Also note that if a measurement matches multiple time zones (i.e. a timezone change occurred during the measurement), the timezone with the longest overlap is chosen.

Examples

if (FALSE) { # \dontrun{
# Connect to an m-Path Sense database
db <- open_db("path/to/db.sqlite")

# Add timezone information to all tables
add_timezones_to_db(db)

# Disconnect when done
close_db(db)
} # }