set->time.used = 0;
- f_string_t string = f_string_t_initialize;
-
{
- time_t t = time(NULL);
-
- string = asctime(gmtime(&t));
- }
+ time_t t = 0;
+ f_time_part_t part = f_time_part_t_initialize;
- if (string) {
- f_number_unsigned_t total = strnlen(string, kt_tacocat_max_asctime_d);
+ set->status = f_time_epoch_get(&t);
- // Do not count the NULL (some strnlen() implementations, like glibc, appear to incorrectly include the terminating NULL in the count.
- if (total && !string[total]) {
- --total;
+ if (F_status_is_error_not(set->status)) {
+ set->status = f_time_utc_get(t, &part);
}
- set->status = f_memory_array_increase_by(total + kt_tacocat_time_utc_s.used + 1, sizeof(f_char_t), (void **) &set->time.string, &set->time.used, &set->time.size);
- if (F_status_is_error(set->status)) return;
-
- set->status = f_string_append(string, total, &set->time);
- if (F_status_is_error(set->status)) return;
+ if (F_status_is_error_not(set->status)) {
+ set->status = f_time_calendar_string_part(part, &set->time);
+ }
+ }
+ if (F_status_is_error_not(set->status)) {
set->status = f_string_dynamic_append(kt_tacocat_time_utc_s, &set->time);
- if (F_status_is_error(set->status)) return;
+ }
+ if (F_status_is_error_not(set->status)) {
set->status = f_string_dynamic_terminate_after(&set->time);
- if (F_status_is_error(set->status)) return;
+ }
+ if (F_status_is_error_not(set->status)) {
set->status = F_okay;
}
- else {
- set->status = F_status_set_error(F_time);
- }
}
#endif // _di_kt_tacocat_send_process_time_now_
*
* F_time (with error bit) on failure to get the time.
*
- * Errors (with error bit) from: f_memory_array_increase_by().
- * Errors (with error bit) from: f_string_append().
* Errors (with error bit) from: f_string_dynamic_append().
* Errors (with error bit) from: f_string_dynamic_terminate_after().
+ * Errors (with error bit) from: f_time_calendar_string_part().
+ * Errors (with error bit) from: f_time_epoch_get().
+ * Errors (with error bit) from: f_time_utc_get().
*
- * @see f_memory_array_increase_by()
- * @see f_string_append()
* @see f_string_dynamic_append()
* @see f_string_dynamic_terminate_after()
- *
- * @see asctime()
- * @see gmtime()
- * @see strnlen()
+ * @see f_time_calendar_string_part()
+ * @see f_time_epoch_get()
+ * @see f_time_utc_get()
*/
#ifndef _di_kt_tacocat_send_process_time_now_
extern void kt_tacocat_send_process_time_now(kt_tacocat_socket_set_t * const set);