Looks about right. You can save the dtx copy though, so: const dbi_datetimex *dtx = &result->rows[row]->field_values[idx].d_datetimex; struct tm copy = dtx->tm; time64 time = timegm(©) - dtx->utc_offset;