- struct tm t;
-
- /* Parse input and assign appropriately to tm_time */
-
- if (t =
- *tm_time, sscanf(t_string, "%d:%d:%d", &t.tm_hour, &t.tm_min,
- &t.tm_sec) == 3) {
- /* no adjustments needed */
- } else if (t =
- *tm_time, sscanf(t_string, "%d:%d", &t.tm_hour,
- &t.tm_min) == 2) {
- /* no adjustments needed */
- } else if (t =
- *tm_time, sscanf(t_string, "%d.%d-%d:%d:%d", &t.tm_mon,
- &t.tm_mday, &t.tm_hour, &t.tm_min,
- &t.tm_sec) == 5) {
- /* Adjust dates from 1-12 to 0-11 */
- t.tm_mon -= 1;
- } else if (t =
- *tm_time, sscanf(t_string, "%d.%d-%d:%d", &t.tm_mon,
- &t.tm_mday, &t.tm_hour, &t.tm_min) == 4) {
- /* Adjust dates from 1-12 to 0-11 */
- t.tm_mon -= 1;
- } else if (t =
- *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d:%d", &t.tm_year,
- &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min,
- &t.tm_sec) == 6) {
- t.tm_year -= 1900; /* Adjust years */
- t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
- } else if (t =
- *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d", &t.tm_year,
- &t.tm_mon, &t.tm_mday, &t.tm_hour,
- &t.tm_min) == 5) {
- t.tm_year -= 1900; /* Adjust years */
- t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
- } else {
- bb_error_msg_and_die(bb_msg_invalid_date, t_string);
- }
- *tm_time = t;
- return (tm_time);
-}
-
-#define DATE_OPT_RFC2822 0x01
-#define DATE_OPT_SET 0x02
-#define DATE_OPT_UTC 0x04
-#define DATE_OPT_DATE 0x08
-#define DATE_OPT_REFERENCE 0x10
-#ifdef CONFIG_FEATURE_DATE_ISOFMT
-# define DATE_OPT_TIMESPEC 0x20
-#endif
-
-int date_main(int argc, char **argv)
-{
- char *date_str = NULL;
- char *date_fmt = NULL;
- int set_time;
- int utc;
- int use_arg = 0;
- time_t tm;
- unsigned long opt;