declare local var.offset_by_hour FLOAT;

// Add TZ in ISO8601 format
set req.http.tz-offset-iso8601 = regsub(client.geo.utc_offset, "^(-?)(...)$", "\10\2");

// Parse the time offset into a decimal number of hours
set var.offset_by_hour = client.geo.utc_offset;
set var.offset_by_hour %= 100; # Fraction of an hour
set var.offset_by_hour /= 60; # Convert to minutes
set var.offset_by_hour += std.atoi(regsub(client.geo.utc_offset, "..$", "")); # Add number of whole hours
set req.http.tz-offset-hours = var.offset_by_hour;

// Round to a whole hour
set req.http.tz-hour = regsub(math.round(var.offset_by_hour), ".000$", "");

// Round to nearest even hour
set var.offset_by_hour /= 2;
set var.offset_by_hour = math.round(var.offset_by_hour);
set var.offset_by_hour *= 2;
set req.http.tz-evenhour = regsub(var.offset_by_hour, ".000$", "");