if (matches & kt_remove_flag_convert_match_d) {
fl_conversion_data_t conversion_data = fl_conversion_data_base_10_c;
- date->start_year = 0;
- date->start_second = 0;
- date->start_nanosecond = 0;
- date->stop_second = 0;
- date->stop_nanosecond = 0;
- date->stop_year = 0;
+ date->start_nanosecond = date->stop_nanosecond = 0;
+ date->start_second = date->stop_second = 0;
+ date->start_year = date->stop_year = 0;
date->type = 0;
// Process the first character.
memset(&time, 0, sizeof(struct tm));
if (strptime(buffer.string, formats[i], &time) != 0) {
- date->start_year = kt_remove_time_year_unix_epoch_d;
- date->start_nanosecond = 0;
- date->stop_second = 0;
- date->stop_nanosecond = 0;
- date->stop_year = 0;
+ date->start_nanosecond = date->stop_nanosecond = 0;
+ date->start_year = date->stop_year = kt_remove_time_year_unix_epoch_d;
date->type = kt_remove_flag_date_string_d;
#ifdef _available_timegm_
date->start_second += time.tm_yday * kt_remove_time_seconds_in_day_d;
#endif // _available_timegm_
- date->start_nanosecond = 0;
+ date->stop_second = date->start_second;
matches = 1;
break;
main->setting.state.status = f_time_clock_get(CLOCK_REALTIME, &now);
if (F_status_is_error(main->setting.state.status)) return;
- date->start_year = date->stop_year = kt_remove_time_year_unix_epoch_d;
- date->start_second = date->stop_second = now.tv_sec;
date->start_nanosecond = date->stop_nanosecond = 0;
+ date->start_second = date->stop_second = now.tv_sec;
+ date->start_year = date->stop_year = kt_remove_time_year_unix_epoch_d;
if (date->type == kt_remove_flag_date_now_d) {
date->start_nanosecond = date->stop_nanosecond = now.tv_nsec;
-
- if (!(main->setting.flag & kt_remove_main_flag_utc_d)) {
- kt_remove_convert_timezone(main, &date->start_year, &date->start_second);
- if (F_status_is_error(main->setting.state.status)) return;
- }
-
- main->setting.state.status = F_okay;
-
- return;
}
// Determine start of day.
if (!(main->setting.flag & kt_remove_main_flag_utc_d)) {
kt_remove_convert_timezone(main, &date->start_year, &date->start_second);
if (F_status_is_error(main->setting.state.status)) return;
+
+ date->stop_second = date->start_second;
+ date->stop_year = date->start_year;
+ }
+
+ if (date->type == kt_remove_flag_date_now_d) {
+ main->setting.state.status = F_okay;
+
+ return;
}
date->start_second -= date->start_second % kt_remove_time_seconds_in_day_d;
+ date->stop_second = date->start_second;
if (date->type == kt_remove_flag_date_today_d) {
date->stop_second = date->start_second + kt_remove_time_seconds_in_day_d;
}
}
else if (date->type == kt_remove_flag_date_tomorrow_d) {
+ date->start_second += kt_remove_time_seconds_in_day_d;
+
if (date->start_second > kt_remove_time_seconds_in_year_d) {
date->stop_year = ++date->start_year;
date->start_second -= kt_remove_time_seconds_in_year_d;
kt_remove_long_updated_s,
};
- f_status_t result = F_false;
+ uint8_t result = F_false;
f_string_static_t name_type = f_string_empty_s;
f_number_unsigned_t match_second = 0;
f_number_unsigned_t match_year = 0;
start_year = dates[i]->array[j].start_year + (dates[i]->array[j].start_second / kt_remove_time_seconds_in_year_d);
start_second = dates[i]->array[j].start_second % kt_remove_time_seconds_in_year_d;
+ stop_year = dates[i]->array[j].stop_year + (dates[i]->array[j].stop_second / kt_remove_time_seconds_in_year_d);
+ stop_second = dates[i]->array[j].stop_second % kt_remove_time_seconds_in_year_d;
+
start_is_stop = dates[i]->array[j].start_year == dates[i]->array[j].stop_year && dates[i]->array[j].start_second == dates[i]->array[j].stop_second && dates[i]->array[j].start_nanosecond == dates[i]->array[j].stop_nanosecond;
name_type = f_string_empty_s;
- result = F_okay;
+ result = F_false;
if (dates[i]->array[j].type == kt_remove_flag_date_today_d || dates[i]->array[j].type == kt_remove_flag_date_tomorrow_d || dates[i]->array[j].type == kt_remove_flag_date_yesterday_d) {
- stop_year = dates[i]->array[j].stop_year + (dates[i]->array[j].stop_second / kt_remove_time_seconds_in_year_d);
- stop_second = dates[i]->array[j].stop_second % kt_remove_time_seconds_in_year_d;
-
if (dates[i]->array[j].operation == kt_remove_flag_date_equal_d) {
name_type = kt_remove_date_symbol_equal_s;
result = F_false;