#define FORMAT_TIMESTAMP_RELATIVE_MAX 256
#define FORMAT_TIMESPAN_MAX 64
-int parse_timestamp(const char *t, usec_t *usec);
+int ul_parse_timestamp(const char *t, usec_t *usec);
int get_gmtoff(const struct tm *tp);
/* flags and masks for strxxx_iso() functions */
return 0;
}
-int parse_timestamp(const char *t, usec_t *usec)
+int ul_parse_timestamp(const char *t, usec_t *usec)
{
return parse_timestamp_reference(time(NULL), t, usec);
}
if (strcmp(argv[1], "--timestamp") == 0) {
usec_t usec = 0;
- r = parse_timestamp(argv[2], &usec);
+ r = ul_parse_timestamp(argv[2], &usec);
if (r)
errx(EXIT_FAILURE, "Can not parse '%s': %s", argv[2], strerror(-r));
ts.tv_sec = (time_t) (usec / USEC_PER_SEC);
ctl.time_fmt = LAST_TIMEFTM_CTIME;
break;
case 'p':
- if (parse_timestamp(optarg, &p) < 0)
+ if (ul_parse_timestamp(optarg, &p) < 0)
errx(EXIT_FAILURE, _("invalid time value \"%s\""), optarg);
ctl.present = (time_t) (p / 1000000);
break;
case 's':
- if (parse_timestamp(optarg, &p) < 0)
+ if (ul_parse_timestamp(optarg, &p) < 0)
errx(EXIT_FAILURE, _("invalid time value \"%s\""), optarg);
ctl.since = (time_t) (p / 1000000);
break;
case 't':
- if (parse_timestamp(optarg, &p) < 0)
+ if (ul_parse_timestamp(optarg, &p) < 0)
errx(EXIT_FAILURE, _("invalid time value \"%s\""), optarg);
ctl.until = (time_t) (p / 1000000);
break;
if (argc == 1 && !isdigit_string(*argv)) {
usec_t x;
/* cal <timestamp> */
- if (parse_timestamp(*argv, &x) == 0)
+ if (ul_parse_timestamp(*argv, &x) == 0)
now = (time_t) (x / 1000000);
/* cal <monthname> */
else if ((ctl.req.month = monthname_to_number(&ctl, *argv)) > 0)
break;
case OPT_SINCE:
{
- if (parse_timestamp(optarg, &ctl.since) < 0)
+ if (ul_parse_timestamp(optarg, &ctl.since) < 0)
errx(EXIT_FAILURE, _("invalid time value \"%s\""), optarg);
break;
}
case OPT_UNTIL:
{
- if (parse_timestamp(optarg, &ctl.until) < 0)
+ if (ul_parse_timestamp(optarg, &ctl.until) < 0)
errx(EXIT_FAILURE, _("invalid time value \"%s\""), optarg);
break;
}
/* minimalistic GPLv2 based parser */
usec_t usec;
- if (parse_timestamp(ctl.date_opt, &usec) == 0)
+ if (ul_parse_timestamp(ctl.date_opt, &usec) == 0)
set_time = (time_t) (usec / 1000000);
#endif
else {
case OPT_DATE:
{ /* alarm time, see timestamp format from manual */
usec_t p;
- if (parse_timestamp(optarg, &p) < 0)
+ if (ul_parse_timestamp(optarg, &p) < 0)
errx(EXIT_FAILURE, _("invalid time value \"%s\""), optarg);
alarm = (time_t) (p / 1000000);
break;