CSA_attribute_reference name = CSA_ENTRY_ATTR_END_DATE; char buffer[80]; time_t endtime; CSA_entry_handle new_entry; for (i = 0; i < num_entries; i++) { /* get the end time of the appointment */ stat = csa_read_entry_attributes(cal, entries[i], 0, &name, &num_attributes, &entry_attrs, NULL); if (stat == CSA_SUCCESS) { /* change the end time to be one hour later */ from_iso8601_time(entry_attrs[0].value->item.date_time_value, &endtime); endtime += 60*60 /* number of second in an hour */ to_iso8601_time(endtime, buffer); attrs[0].name = CSA_ENTRY_ATTR_END_DATE; attrs[0].value = &attr_val[i]; attrs[0].attribute_extensions = NULL; attr_val[0].type = CSA_VALUE_DATE_TIME; attr_val[0].item.date_time_value = buffer; stat = csa_update_entry_attributes(cal, entries[0], CSA_SCOPE_ALL, CSA_FALSE, 1, attrs, &new_entry, NULL); if (stat == CSA_SUCCESS) { csa_free(new_entry); } else { /* handle error */ } csa_free(entry_attrs); } else { /* handle error */ } } |