index af9cf0e87af48111c346d9408e968ec789763788..d14d6d1323871738f46e9d3da9421be89191c85f 100644 (file)
--- a/src/utils_cmd_putnotif.c
+++ b/src/utils_cmd_putnotif.c
static int set_option_time (notification_t *n, const char *value)
{
- time_t tmp;
-
- tmp = (time_t) atoi (value);
- if (tmp <= 0)
+ char *endptr = NULL;
+ double tmp;
+
+ errno = 0;
+ tmp = strtod (value, &endptr);
+ if ((errno != 0) /* Overflow */
+ || (endptr == value) /* Invalid string */
+ || (endptr == NULL) /* This should not happen */
+ || (*endptr != 0)) /* Trailing chars */
return (-1);
- n->time = tmp;
+ n->time = DOUBLE_TO_CDTIME_T (tmp);
return (0);
} /* int set_option_time */