The f_time_spec_t is not the same as "struct timespec".
Avoid confusion by renaming it to f_time_simple_t.
rename f_date_spec_t to f_date_simple_t for the same reason.
Add additional types and now that f_time_spec_t is available, create f_time_spec_t as a typedef of "struct timespec".
Update the stand alone build scripts with all of these changes and some changes from previous commits.
//#define _di_f_conversion_number_signed_to_string_
//#define _di_f_conversion_number_unsigned_print_
//#define _di_f_conversion_number_unsigned_to_string_
-#define _di_f_date_spec_t_
+#define _di_f_date_simple_t_
#define _di_f_date_t_
#define _di_f_file_access_
#define _di_f_file_access_at_
#define _di_fll_print_trim_raw_
#define _di_fll_print_trim_raw_safely_
#define _di_fll_print_trim_safely_
+//#define _di_fll_program_copyright_s_
+//#define _di_fll_program_copyright_year_author_s_
//#define _di_fll_program_data_delete_
#define _di_fll_program_data_destroy_
//#define _di_fll_program_data_pipe_e_
#define _di_f_thread_spin_t_
#define _di_f_thread_spin_unlock_
#define _di_f_thread_unlock_
+#define _di_f_time_part_t_
+#define _di_f_time_simple_t_
#define _di_f_time_spec_t_
#define _di_f_time_t_
//#define _di_f_type_d_
//
// Example:
// echo > /tmp/all.txt
-// for i in f_type f_status f_memory f_type_array f_string f_utf f_color f_console f_conversion f_file f_pipe f_print f_rip f_signal f_thread ; do grep -horP '\b_di_f_\w*\b' level_0/$i/c >> /tmp/all.txt ; grep -horP '\b_di_macro_\w*\b' level_0/$i/c >> /tmp/all.txt ; done
+// for i in f_type f_status f_memory f_type_array f_string f_utf f_color f_console f_conversion f_file f_pipe f_print f_rip f_signal f_time f_thread ; do grep -horP '\b_di_f_\w*\b' level_0/$i/c >> /tmp/all.txt ; grep -horP '\b_di_macro_\w*\b' level_0/$i/c >> /tmp/all.txt ; done
// for i in fl_print ; do grep -horP '\b_di_fl_\w*\b' level_1/$i/c >> /tmp/all.txt ; grep -horP '\b_di_macro_\w*\b' level_1/$i/c >> /tmp/all.txt ; done
// for i in fll_error fll_print fll_program ; do grep -horP '\b_di_fll_\w*\b' level_2/$i/c >> /tmp/all.txt ; grep -horP '\b_di_macro_\w*\b' level_2/$i/c >> /tmp/all.txt ; done
// sort /tmp/all.txt | uniq | sed -e 's|^_|#define &|g' > /tmp/sorted.txt
//#define _di_f_conversion_number_signed_to_string_
//#define _di_f_conversion_number_unsigned_print_
//#define _di_f_conversion_number_unsigned_to_string_
-#define _di_f_date_spec_t_
+#define _di_f_date_simple_t_
#define _di_f_date_t_
#define _di_f_file_access_
#define _di_f_file_access_at_
#define _di_fll_print_trim_raw_
#define _di_fll_print_trim_raw_safely_
#define _di_fll_print_trim_safely_
+//#define _di_fll_program_copyright_s_
+//#define _di_fll_program_copyright_year_author_s_
//#define _di_fll_program_data_delete_
#define _di_fll_program_data_destroy_
//#define _di_fll_program_data_pipe_e_
#define _di_f_thread_spin_t_
#define _di_f_thread_spin_unlock_
#define _di_f_thread_unlock_
+#define _di_f_time_part_t_
+#define _di_f_time_simple_t_
#define _di_f_time_spec_t_
#define _di_f_time_t_
//#define _di_f_type_d_
//#define _di_f_conversion_number_signed_to_string_
//#define _di_f_conversion_number_unsigned_print_
//#define _di_f_conversion_number_unsigned_to_string_
-#define _di_f_date_spec_t_
+#define _di_f_date_simple_t_
#define _di_f_date_t_
//#define _di_f_directory_at_d_
#define _di_f_directory_back_s_
#define _di_f_fss_payload_object_name_s_
#define _di_f_fss_payload_object_part_s_
#define _di_f_fss_payload_object_payload_s_
+#define _di_f_fss_payload_object_salt_s_
#define _di_f_fss_payload_object_signature_s_
#define _di_f_fss_payload_object_size_s_
#define _di_f_fss_payload_object_status_s_
+#define _di_f_fss_payload_object_time_s_
#define _di_f_fss_payload_object_total_s_
#define _di_f_fss_payload_object_type_s_
#define _di_f_fss_payload_s_
//#define _di_fl_fss_extended_object_read_
#define _di_fl_fss_extended_object_write_
#define _di_fl_fss_payload_d_
+#define _di_fl_fss_payload_header_internal_t_
#define _di_fl_fss_payload_header_map_
#define _di_fl_fss_payload_header_maps_
+#define _di_fl_fss_payload_header_state_t_
//#define _di_fl_iki_read_
//#define _di_f_limit_process_
#define _di_f_limit_setss_delete_callback_
#define _di_fll_print_trim_raw_
#define _di_fll_print_trim_raw_safely_
#define _di_fll_print_trim_safely_
+//#define _di_fll_program_copyright_s_
+//#define _di_fll_program_copyright_year_author_s_
//#define _di_fll_program_data_delete_
#define _di_fll_program_data_destroy_
//#define _di_fll_program_data_pipe_e_
#define _di_f_thread_spin_t_
#define _di_f_thread_spin_unlock_
#define _di_f_thread_unlock_
+#define _di_f_time_part_t_
+#define _di_f_time_simple_t_
#define _di_f_time_spec_t_
#define _di_f_time_t_
//#define _di_f_type_d_
//#define _di_f_conversion_number_signed_to_string_
//#define _di_f_conversion_number_unsigned_print_
//#define _di_f_conversion_number_unsigned_to_string_
-#define _di_f_date_spec_t_
+#define _di_f_date_simple_t_
#define _di_f_date_t_
#define _di_f_directory_at_d_
//#define _di_f_directory_back_s_
#define _di_f_fss_payload_object_name_s_
#define _di_f_fss_payload_object_part_s_
#define _di_f_fss_payload_object_payload_s_
+#define _di_f_fss_payload_object_salt_s_
#define _di_f_fss_payload_object_signature_s_
#define _di_f_fss_payload_object_size_s_
#define _di_f_fss_payload_object_status_s_
+#define _di_f_fss_payload_object_time_s_
#define _di_f_fss_payload_object_total_s_
#define _di_f_fss_payload_object_type_s_
#define _di_f_fss_payload_s_
//#define _di_fl_fss_extended_object_read_
#define _di_fl_fss_extended_object_write_
#define _di_fl_fss_payload_d_
+#define _di_fl_fss_payload_header_internal_t_
#define _di_fl_fss_payload_header_map_
#define _di_fl_fss_payload_header_maps_
+#define _di_fl_fss_payload_header_state_t_
#define _di_fl_iki_read_
//#define _di_f_limit_process_
#define _di_f_limit_setss_delete_callback_
#define _di_fll_print_trim_raw_
#define _di_fll_print_trim_raw_safely_
#define _di_fll_print_trim_safely_
+//#define _di_fll_program_copyright_s_
+//#define _di_fll_program_copyright_year_author_s_
//#define _di_fll_program_data_delete_
#define _di_fll_program_data_destroy_
//#define _di_fll_program_data_pipe_e_
#define _di_f_thread_spin_t_
#define _di_f_thread_spin_unlock_
#define _di_f_thread_unlock_
+#define _di_f_time_calendar_string_
+#define _di_f_time_calendar_string_part_
+#define _di_f_time_epoch_get_
+#define _di_f_time_local_get_
+#define _di_f_time_of_day_get_
+#define _di_f_time_of_day_set_
+#define _di_f_time_part_t_
+#define _di_f_time_simple_t_
#define _di_f_time_spec_millisecond_
#define _di_f_time_spec_nanosecond_
#define _di_f_time_spec_t_
+#define _di_f_time_utc_get_
#define _di_f_time_t_
//#define _di_f_type_d_
//#define _di_f_type_file_defaults_d_
//#define _di_f_conversion_number_signed_to_string_
//#define _di_f_conversion_number_unsigned_print_
//#define _di_f_conversion_number_unsigned_to_string_
-#define _di_f_date_spec_t_
+#define _di_f_date_simple_t_
#define _di_f_date_t_
#define _di_f_file_access_
#define _di_f_file_access_at_
#define _di_fll_print_trim_raw_
#define _di_fll_print_trim_raw_safely_
#define _di_fll_print_trim_safely_
+//#define _di_fll_program_copyright_s_
+//#define _di_fll_program_copyright_year_author_s_
//#define _di_fll_program_data_delete_
#define _di_fll_program_data_destroy_
//#define _di_fll_program_data_pipe_e_
#define _di_f_thread_spin_t_
#define _di_f_thread_spin_unlock_
#define _di_f_thread_unlock_
+#define _di_f_time_part_t_
+#define _di_f_time_simple_t_
+#define _di_f_time_spec_millisecond_
+#define _di_f_time_spec_nanosecond_
#define _di_f_time_spec_t_
#define _di_f_time_t_
//#define _di_f_type_d_
#endif // _di_f_file_select_
#ifndef _di_f_file_select_signal_
- f_status_t f_file_select_signal(const int highest_plus_one, fd_set * const read, fd_set * const write, fd_set * const except, const struct timespec * const timeout, const sigset_t * const signal) {
+ f_status_t f_file_select_signal(const int highest_plus_one, fd_set * const read, fd_set * const write, fd_set * const except, const f_time_spec_t * const timeout, const sigset_t * const signal) {
if (!highest_plus_one) return F_data_not;
if (!read && !write && !except && !timeout) return F_data_not;
// FLL-0 includes.
#include <fll/level_0/type.h>
#include <fll/level_0/type/file.h>
+#include <fll/level_0/type/time.h>
#include <fll/level_0/status.h>
#include <fll/level_0/memory.h>
#include <fll/level_0/string.h>
* @see pselect()
*/
#ifndef _di_f_file_select_signal_
- extern f_status_t f_file_select_signal(const int highest_plus_one, fd_set * const read, fd_set * const write, fd_set * const except, const struct timespec * const timeout, const sigset_t * const signal);
+ extern f_status_t f_file_select_signal(const int highest_plus_one, fd_set * const read, fd_set * const write, fd_set * const except, const f_time_spec_t * const timeout, const sigset_t * const signal);
#endif // _di_f_file_select_signal_
/**
#endif // _di_f_signal_wait_
#ifndef _di_f_signal_wait_until_
- f_status_t f_signal_wait_until(const sigset_t * const set, const struct timespec * timeout, siginfo_t * const information) {
+ f_status_t f_signal_wait_until(const sigset_t * const set, const f_time_spec_t *timeout, siginfo_t * const information) {
if (sigtimedwait(set, information, timeout) == -1) {
if (errno == EAGAIN) return F_time_out;
* @see sigtimedwait()
*/
#ifndef _di_f_signal_wait_until_
- extern f_status_t f_signal_wait_until(const sigset_t * const set, const struct timespec *timeout, siginfo_t * const information);
+ extern f_status_t f_signal_wait_until(const sigset_t * const set, const f_time_spec_t *timeout, siginfo_t * const information);
#endif // _di_f_signal_wait_until_
#ifdef __cplusplus
#endif // _di_f_thread_condition_wait_
#ifndef _di_f_thread_condition_wait_timed_
- f_status_t f_thread_condition_wait_timed(const struct timespec *wait, f_thread_condition_t * const condition, f_thread_mutex_t * const mutex) {
+ f_status_t f_thread_condition_wait_timed(const f_time_spec_t *wait, f_thread_condition_t * const condition, f_thread_mutex_t * const mutex) {
#ifndef _di_level_0_parameter_checking_
if (!condition) return F_status_set_error(F_parameter);
if (!mutex) return F_status_set_error(F_parameter);
#endif // _di_f_thread_join_try_
#ifndef _di_f_thread_join_timed_
- f_status_t f_thread_join_timed(const f_thread_id_t id, const struct timespec wait, void **result) {
+ f_status_t f_thread_join_timed(const f_thread_id_t id, const f_time_spec_t wait, void **result) {
const int error = pthread_timedjoin_np(id, result, &wait);
#endif // _di_f_thread_lock_read_
#ifndef _di_f_thread_lock_read_timed_
- f_status_t f_thread_lock_read_timed(const struct timespec * const timeout, f_thread_lock_t * const lock) {
+ f_status_t f_thread_lock_read_timed(const f_time_spec_t * const timeout, f_thread_lock_t * const lock) {
#ifndef _di_level_0_parameter_checking_
if (!timeout) return F_status_set_error(F_parameter);
if (!lock) return F_status_set_error(F_parameter);
#endif // _di_f_thread_lock_write_
#ifndef _di_f_thread_lock_write_timed_
- f_status_t f_thread_lock_write_timed(const struct timespec * const timeout, f_thread_lock_t * const lock) {
+ f_status_t f_thread_lock_write_timed(const f_time_spec_t * const timeout, f_thread_lock_t * const lock) {
#ifndef _di_level_0_parameter_checking_
if (!timeout) return F_status_set_error(F_parameter);
if (!lock) return F_status_set_error(F_parameter);
#endif // _di_f_thread_mutex_lock_
#ifndef _di_f_thread_mutex_lock_timed_
- f_status_t f_thread_mutex_lock_timed(const struct timespec * const timeout, f_thread_mutex_t * const mutex) {
+ f_status_t f_thread_mutex_lock_timed(const f_time_spec_t * const timeout, f_thread_mutex_t * const mutex) {
#ifndef _di_level_0_parameter_checking_
if (!timeout) return F_status_set_error(F_parameter);
if (!mutex) return F_status_set_error(F_parameter);
#endif // _di_f_thread_semaphore_lock_
#ifndef _di_f_thread_semaphore_lock_timed_
- f_status_t f_thread_semaphore_lock_timed(const struct timespec * const timeout, f_thread_semaphore_t * const semaphore) {
+ f_status_t f_thread_semaphore_lock_timed(const f_time_spec_t * const timeout, f_thread_semaphore_t * const semaphore) {
#ifndef _di_level_0_parameter_checking_
if (!timeout) return F_status_set_error(F_parameter);
if (!semaphore) return F_status_set_error(F_parameter);
* @see pthread_cond_timedwait()
*/
#ifndef _di_f_thread_condition_wait_timed_
- extern f_status_t f_thread_condition_wait_timed(const struct timespec *wait, f_thread_condition_t * const condition, f_thread_mutex_t * const mutex);
+ extern f_status_t f_thread_condition_wait_timed(const f_time_spec_t *wait, f_thread_condition_t * const condition, f_thread_mutex_t * const mutex);
#endif // _di_f_thread_condition_wait_timed_
/**
* @see pthread_timedjoin_np()
*/
#ifndef _di_f_thread_join_timed_
- extern f_status_t f_thread_join_timed(const f_thread_id_t id, const struct timespec wait, void **result);
+ extern f_status_t f_thread_join_timed(const f_thread_id_t id, const f_time_spec_t wait, void **result);
#endif // _di_f_thread_join_timed_
/**
* @see pthread_rwlock_timedrdlock()
*/
#ifndef _di_f_thread_lock_read_timed_
- extern f_status_t f_thread_lock_read_timed(const struct timespec * const timeout, f_thread_lock_t * const lock);
+ extern f_status_t f_thread_lock_read_timed(const f_time_spec_t * const timeout, f_thread_lock_t * const lock);
#endif // _di_f_thread_lock_read_timed_
/**
* @see pthread_rwlock_timedwrlock()
*/
#ifndef _di_f_thread_lock_write_timed_
- extern f_status_t f_thread_lock_write_timed(const struct timespec * const timeout, f_thread_lock_t * const lock);
+ extern f_status_t f_thread_lock_write_timed(const f_time_spec_t * const timeout, f_thread_lock_t * const lock);
#endif // _di_f_thread_lock_write_timed_
/**
* @see pthread_mutex_timedlock()
*/
#ifndef _di_f_thread_mutex_lock_timed_
- extern f_status_t f_thread_mutex_lock_timed(const struct timespec * const timeout, f_thread_mutex_t * const mutex);
+ extern f_status_t f_thread_mutex_lock_timed(const f_time_spec_t * const timeout, f_thread_mutex_t * const mutex);
#endif // _di_f_thread_mutex_lock_timed_
/**
* @see sem_timedwait()
*/
#ifndef _di_f_thread_semaphore_lock_timed_
- extern f_status_t f_thread_semaphore_lock_timed(const struct timespec * const timeout, f_thread_semaphore_t * const semaphore);
+ extern f_status_t f_thread_semaphore_lock_timed(const f_time_spec_t * const timeout, f_thread_semaphore_t * const semaphore);
#endif // _di_f_thread_semaphore_lock_timed_
/**
#endif // _di_f_time_of_day_set_
#ifndef _di_f_time_spec_millisecond_
- extern f_status_t f_time_spec_millisecond(const f_number_unsigned_t second, const f_number_unsigned_t millisecond, struct timespec * const time) {
+ extern f_status_t f_time_spec_millisecond(const f_number_unsigned_t second, const f_number_unsigned_t millisecond, f_time_spec_t * const time) {
#ifndef _di_level_0_parameter_checking_
if (!time) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
#endif // _di_f_time_spec_millisecond_
#ifndef _di_f_time_spec_nanosecond_
- extern f_status_t f_time_spec_nanosecond(const f_number_unsigned_t second, const f_number_unsigned_t nanosecond, struct timespec * const time) {
+ extern f_status_t f_time_spec_nanosecond(const f_number_unsigned_t second, const f_number_unsigned_t nanosecond, f_time_spec_t * const time) {
#ifndef _di_level_0_parameter_checking_
if (!time) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
// FLL-0 includes.
#include <fll/level_0/type.h>
+#include <fll/level_0/type/time.h>
#include <fll/level_0/status.h>
#include <fll/level_0/string.h>
/**
* Create a timespec representing the given seconds and milliseconds.
*
- * This is intended to work with "struct timespec" and is not intended to work with "f_time_spec_t".
- * The "struct timespec" may have different lengths and so this function provides overflow and underflow protection.
- * The "f_time_spec_t" should not need this as "f_time_spec_t" is intended to always be uint64_t.
+ * The "f_time_spec_t" may have different lengths and so this function provides overflow and underflow protection.
+ * The "f_time_simple_t" should not need this as "f_time_simple_t" is intended to always be uint64_t.
*
* @param second
* The number of seconds.
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_time_spec_millisecond_
- extern f_status_t f_time_spec_millisecond(const f_number_unsigned_t second, const f_number_unsigned_t millisecond, struct timespec * const time);
+ extern f_status_t f_time_spec_millisecond(const f_number_unsigned_t second, const f_number_unsigned_t millisecond, f_time_spec_t * const time);
#endif // _di_f_time_spec_millisecond_
/**
* Create a timespec representing the given seconds and nanoseconds.
*
- * This is intended to work with "struct timespec" and is not intended to work with "f_time_spec_t".
- * The "struct timespec" may have different lengths and so this function provides overflow and underflow protection.
- * The "f_time_spec_t" should not need this as "f_time_spec_t" is intended to always be uint64_t.
+ * The "f_time_spec_t" may have different lengths and so this function provides overflow and underflow protection.
+ * The "f_time_simple_t" should not need this as "f_time_simple_t" is intended to always be uint64_t.
*
* @param second
* The number of seconds.
* F_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_time_spec_nanosecond_
- extern f_status_t f_time_spec_nanosecond(const f_number_unsigned_t second, const f_number_unsigned_t nanosecond, struct timespec * const time);
+ extern f_status_t f_time_spec_nanosecond(const f_number_unsigned_t second, const f_number_unsigned_t nanosecond, f_time_spec_t * const time);
#endif // _di_f_time_spec_nanosecond_
/**
#define F_time_calendar_string_length_d 27
#endif // _di_f_time_d_
-/**
- * A typedef representing struct timeval.
- */
-#ifndef _di_f_time_value_t_
- typedef struct timeval f_time_value_t;
-
- #define f_time_value_t_initialize { 0 }
-#endif // _di_f_time_value_t_
-
-/**
- * A typedef representing struct tm.
- */
-#ifndef _di_f_time_part_t_
- typedef struct tm f_time_part_t;
-
- #define f_time_part_t_initialize { 0 }
-#endif // _di_f_time_part_t_
-
#ifdef __cplusplus
} // extern "C"
#endif
second = (f_number_unsigned_t) ((time_t) (-1));
}
- struct timespec time = { 0 };
+ f_time_spec_t time = { 0 };
{
const f_status_t status = f_time_spec_millisecond(second, 1000, &time);
void test__f_time_spec_millisecond__number_underflow(void **state) {
- struct timespec time = { .tv_sec = -1, .tv_nsec = -1 };
+ f_time_spec_t time = { .tv_sec = -1, .tv_nsec = -1 };
// If this system has uses unsigned, then this test is not needed.
if (time.tv_sec >= 0 && time.tv_nsec >= 0) return;
void test__f_time_spec_millisecond__works(void **state) {
- struct timespec time = { 0 };
+ f_time_spec_t time = { 0 };
{
const f_number_unsigned_t seconds[] = {
second = (f_number_unsigned_t) ((time_t) (-1));
}
- struct timespec time = { 0 };
+ f_time_spec_t time = { 0 };
{
const f_status_t status = f_time_spec_nanosecond(second, 1000000000, &time);
void test__f_time_spec_nanosecond__number_underflow(void **state) {
- struct timespec time = { .tv_sec = -1, .tv_nsec = -1 };
+ f_time_spec_t time = { .tv_sec = -1, .tv_nsec = -1 };
// If this system has uses unsigned, then this test is not needed.
if (time.tv_sec >= 0 && time.tv_nsec >= 0) return;
void test__f_time_spec_nanosecond__works(void **state) {
- struct timespec time = { 0 };
+ f_time_spec_t time = { 0 };
{
const f_number_unsigned_t seconds[] = {
#include <stdbool.h>
#include <stdint.h>
#include <sys/stat.h>
+#include <sys/time.h>
+#include <time.h>
#include <unistd.h>
// FLL-0 type includes.
typedef uint64_t f_time_t;
#define f_time_t_initialize 0
+
+ #define macro_f_time_t_clear(time) \
+ time = 0;
#endif // _di_f_time_t_
/**
+ * A typedef representing struct tm.
+ */
+#ifndef _di_f_time_part_t_
+ typedef struct tm f_time_part_t;
+
+ #define f_time_part_t_initialize { 0 }
+#endif // _di_f_time_part_t_
+
+/**
+ * A typedef representing struct timespec.
+ */
+#ifndef _di_f_time_spec_t_
+ typedef struct timespec f_time_spec_t;
+
+ #define f_time_spec_t_initialize { 0 }
+#endif // _di_f_time_spec_t_
+
+/**
+ * A typedef representing struct timeval.
+ */
+#ifndef _di_f_time_value_t_
+ typedef struct timeval f_time_value_t;
+
+ #define f_time_value_t_initialize { 0 }
+#endif // _di_f_time_value_t_
+
+/**
* A non-kernel dependent alternative version of "struct timespec".
*
* This is may not compatible with struct timespec because seconds is time_t and that may not be a uint64_t.
* - seconds: The total number of seconds.
* - seconds_nano: The total number of nanoseconds.
*/
-#ifndef _di_f_time_spec_t_
+#ifndef _di_f_time_simple_t_
typedef struct {
f_time_t seconds;
f_time_t seconds_nano;
- } f_time_spec_t;
+ } f_time_simple_t;
- #define f_time_spec_t_initialize { f_time_t_initialize, f_time_t_initialize }
+ #define f_time_simple_t_initialize { f_time_t_initialize, f_time_t_initialize }
- #define macro_f_time_spec_t_clear(spec) \
- spec.seconds = 0; \
- spec.seconds_nano = 0;
-#endif // _di_f_time_spec_t_
+ #define macro_f_time_simple_t_clear(simple) \
+ macro_f_time_t_clear(simple.seconds); \
+ macro_f_time_t_clear(simple.seconds_nano);
+#endif // _di_f_time_simple_t_
/**
* Hold a unit of Time along with a year to represent a date.
f_time_t time;
} f_date_t;
- #define f_date_t_initialize { 0, 0 }
+ #define f_date_t_initialize { f_time_t_initialize, f_time_t_initialize }
#define macro_f_date_t_clear(date) \
date.year = 0; \
- date.time = 0;
+ macro_f_time_t_clear(date.time);
#endif // _di_f_date_t_
/**
- * A variation of f_date_t that using f_time_spec_t rather than f_time_t.
+ * A variation of f_date_t that using f_time_simple_t rather than f_time_t.
*
* This can is a more precise alternative to f_date_t because it stores nanoseconds.
*
- * The f_time_spec_t.time.seconds can be directly cast to the f_date_t.time.
+ * The f_time_simple_t.time.seconds can be directly cast to the f_date_t.time.
*
* Properties:
* - year: A number representing the year.
* - time: A number representing the time with seconds and nanoseconds.
*/
-#ifndef _di_f_date_spec_t_
+#ifndef _di_f_date_simple_t_
typedef struct {
f_time_t year;
- f_time_spec_t time;
- } f_date_spec_t;
+ f_time_simple_t time;
+ } f_date_simple_t;
- #define f_date_spec_t_initialize { f_time_t_initialize, macro_f_time_spec_t_clear }
+ #define f_date_simple_t_initialize { f_time_t_initialize, macro_f_time_simple_t_clear }
- #define macro_f_date_spec_t_clear(date) \
- date.year = 0; \
- macro_f_time_spec_t_clear(date.time);
-#endif // _di_f_date_spec_t_
+ #define macro_f_date_simple_t_clear(date) \
+ macro_f_time_t_clear(date.year); \
+ macro_f_time_simple_t_clear(date.time);
+#endif // _di_f_date_simple_t_
#ifdef __cplusplus
} // extern "C"
uid_t user;
gid_t group;
- f_time_spec_t timestamp;
+ f_time_simple_t timestamp;
f_string_dynamic_t alias;
f_string_dynamic_t engine;
0, \
0, \
0, \
- f_time_spec_t_initialize, \
+ f_time_simple_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
*/
#ifndef _di_controller_cache_t_
typedef struct {
- f_time_spec_t timestamp;
+ f_time_simple_t timestamp;
f_range_t range_action;
} controller_cache_t;
#define controller_cache_t_initialize { \
- f_time_spec_t_initialize, \
+ f_time_simple_t_initialize, \
f_range_t_initialize, \
f_number_unsigneds_t_initialize, \
f_number_unsigneds_t_initialize, \
cache->action.name_file.used = 0;
cache->buffer_file.used = 0;
- macro_f_time_spec_t_clear(cache->timestamp);
+ macro_f_time_simple_t_clear(cache->timestamp);
status = f_string_dynamic_append(path_prefix, &cache->action.name_file);
#endif // _di_controller_status_simplify_error_
#ifndef _di_controller_time_
- void controller_time(const time_t seconds, const long nanoseconds, struct timespec *time) {
+ void controller_time(const time_t seconds, const long nanoseconds, f_time_spec_t *time) {
struct timeval now;
#endif // _di_controller_time_
#ifndef _di_controller_time_milliseconds_
- struct timespec controller_time_milliseconds(const f_number_unsigned_t milliseconds) {
+ f_time_spec_t controller_time_milliseconds(const f_number_unsigned_t milliseconds) {
// @todo update all of these type of functions to use the newer f_time_spec_milliseconds() and f_time_spec_nanoseconds() as appropriate.
- struct timespec time;
+ f_time_spec_t time;
time.tv_sec = milliseconds > 1000 ? milliseconds / 1000 : 0;
time.tv_nsec = (time.tv_sec ? milliseconds - time.tv_sec : milliseconds) * 1000;
#endif // _di_controller_time_milliseconds_
#ifndef _di_controller_time_seconds_
- struct timespec controller_time_seconds(const f_number_unsigned_t seconds) {
+ f_time_spec_t controller_time_seconds(const f_number_unsigned_t seconds) {
- struct timespec time;
+ f_time_spec_t time;
time.tv_sec = seconds;
time.tv_nsec = 0;
#endif // _di_controller_time_seconds_
#ifndef _di_controller_time_sleep_nanoseconds_
- int controller_time_sleep_nanoseconds(controller_main_t * const main, controller_process_t * const setting, struct timespec time) {
+ int controller_time_sleep_nanoseconds(controller_main_t * const main, controller_process_t * const setting, f_time_spec_t time) {
// When sleep is a second or more, instead wait for terminating signals if interruptible.
if ((setting->flag & controller_setting_flag_interruptible_e) && time.tv_sec) {
* Get the current time, plus the given offset.
*
* @todo this is basic enough that there needs to be an f_time class with this function f_time_now(), f_time_future(), f_time_past().
- * "struct timespec" -> f_time_nano_t, "struct timeval" -> f_time_micro_t.
+ * "f_time_spec_t" -> f_time_nano_t, "struct timeval" -> f_time_micro_t.
*
* @param seconds
* The seconds to add to current time.
* The resulting current time.
*/
#ifndef _di_controller_time_
- void controller_time(const time_t seconds, const long nanoseconds, struct timespec *time) F_attribute_visibility_internal_d;
+ void controller_time(const time_t seconds, const long nanoseconds, f_time_spec_t *time) F_attribute_visibility_internal_d;
#endif // _di_controller_time_
/**
* @see nanosleep()
*/
#ifndef _di_controller_time_milliseconds_
- extern struct timespec controller_time_milliseconds(const f_number_unsigned_t milliseconds) F_attribute_visibility_internal_d;
+ extern f_time_spec_t controller_time_milliseconds(const f_number_unsigned_t milliseconds) F_attribute_visibility_internal_d;
#endif // _di_controller_time_milliseconds_
/**
* @see nanosleep()
*/
#ifndef _di_controller_time_seconds_
- extern struct timespec controller_time_seconds(const f_number_unsigned_t seconds) F_attribute_visibility_internal_d;
+ extern f_time_spec_t controller_time_seconds(const f_number_unsigned_t seconds) F_attribute_visibility_internal_d;
#endif // _di_controller_time_seconds_
/**
* @see nanosleep()
*/
#ifndef _di_controller_time_sleep_nanoseconds_
- extern int controller_time_sleep_nanoseconds(controller_main_t * const main, controller_process_t * const setting, struct timespec time) F_attribute_visibility_internal_d;
+ extern int controller_time_sleep_nanoseconds(controller_main_t * const main, controller_process_t * const setting, f_time_spec_t time) F_attribute_visibility_internal_d;
#endif // _di_controller_time_sleep_nanoseconds_
/**
cache->action.line_action = 0;
cache->action.line_item = 0;
- macro_f_time_spec_t_clear(cache->timestamp);
+ macro_f_time_simple_t_clear(cache->timestamp);
cache->comments.used = 0;
cache->delimits.used = 0;
#ifndef _di_controller_lock_read_
f_status_t controller_lock_read(const bool is_normal, controller_thread_t * const thread, f_thread_lock_t *lock) {
- struct timespec time;
+ f_time_spec_t time;
f_status_t status = F_okay;
#ifndef _di_controller_lock_write_
f_status_t controller_lock_write(const bool is_normal, controller_thread_t * const thread, f_thread_lock_t *lock) {
- struct timespec time;
+ f_time_spec_t time;
f_status_t status = F_okay;
return F_status_set_error(F_interrupt);
}
- struct timespec time;
+ f_time_spec_t time;
f_status_t status = F_okay;
f_status_t status_lock = F_okay;
// Sleep for less than a second to better show simulation of synchronous vs asynchronous.
{
- const struct timespec delay = controller_time_milliseconds(controller_thread_simulation_timeout_d);
+ const f_time_spec_t delay = controller_time_milliseconds(controller_thread_simulation_timeout_d);
if (controller_time_sleep_nanoseconds(main, (controller_process_t *) process->main_setting, delay) == -1) {
status = F_status_set_error(F_interrupt);
// Sleep for less than a second to better show simulation of synchronous vs asynchronous.
{
- const struct timespec delay = controller_time_milliseconds(controller_thread_simulation_timeout_d);
+ const f_time_spec_t delay = controller_time_milliseconds(controller_thread_simulation_timeout_d);
if (controller_time_sleep_nanoseconds(main, (controller_process_t *) process->main_setting, delay) == -1) {
status = F_status_set_error(F_interrupt);
}
if (rerun_item->delay) {
- const struct timespec delay = controller_time_milliseconds(rerun_item->delay);
+ const f_time_spec_t delay = controller_time_milliseconds(rerun_item->delay);
if (controller_time_sleep_nanoseconds(main, (controller_process_t *) process->main_setting, delay) == -1) {
return -1;
process->options = options;
process->type = type;
- macro_f_time_spec_t_clear(process->cache.timestamp)
+ macro_f_time_simple_t_clear(process->cache.timestamp)
macro_f_range_t_clear(process->cache.range_action)
process->cache.ats.used = 0;
rule->user = 0;
rule->nice = 0;
- macro_f_time_spec_t_clear(rule->timestamp);
+ macro_f_time_simple_t_clear(rule->timestamp);
rule->alias.used = 0;
rule->engine.used = 0;
if (global->thread->enabled != controller_thread_enabled_e) return 0;
- const struct timespec delay = controller_time_seconds((global->main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e) ? controller_thread_cleanup_interval_short_d : controller_thread_cleanup_interval_long_d);
+ const f_time_spec_t delay = controller_time_seconds((global->main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e) ? controller_thread_cleanup_interval_short_d : controller_thread_cleanup_interval_long_d);
f_status_t status = F_okay;
}
if (F_status_is_error_not(*status) && *status != F_child && entry->global->main->program.parameters.array[controller_parameter_validate_e].result == f_console_result_none_e && entry->global->setting->mode == controller_setting_mode_helper_e) {
- struct timespec time;
+ f_time_spec_t time;
time.tv_sec = controller_thread_exit_helper_timeout_seconds_d;
time.tv_nsec = controller_thread_exit_helper_timeout_nanoseconds_d;
return;
}
- struct timespec time;
+ f_time_spec_t time;
controller_entry_t *entry = 0;
controller_data_t *process = 0;
}
}
else {
- struct timespec time;
+ f_time_spec_t time;
do {
status = f_thread_mutex_lock(&global->thread->lock.alert);
if (!controller_thread_is_enabled(is_normal, global->thread)) return;
siginfo_t information;
- struct timespec time;
+ f_time_spec_t time;
int error = 0;
while (controller_thread_is_enabled(is_normal, global->thread)) {