diff options
author | Douglas Christman <DouglasChristman@gmail.com> | 2016-12-20 16:44:01 -0500 |
---|---|---|
committer | Douglas Christman <DouglasChristman@gmail.com> | 2016-12-20 17:52:55 -0500 |
commit | 60bf5836a0d0796bc4acb818826148411d4b379f (patch) | |
tree | 192ffb693ec62f68c1f84f13a4ce0f68f51db536 /src/basic | |
parent | c0aebb4b3b38caca64ae190f1d523edf46f03969 (diff) |
calendarspec: minor refactoring and style fix
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/calendarspec.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/basic/calendarspec.c b/src/basic/calendarspec.c index 1b1acd3e0b..2e5622699d 100644 --- a/src/basic/calendarspec.c +++ b/src/basic/calendarspec.c @@ -510,12 +510,10 @@ static int parse_component_decimal(const char **p, bool usec, int *res) { return -ERANGE; value *= USEC_PER_SEC; - if (*e == '.') { - unsigned add; - /* This is the start of a range, not a fractional part */ - if (e[1] == '.') - goto finish; + /* One "." is a decimal point, but ".." is a range separator */ + if (e[0] == '.' && e[1] != '.') { + unsigned add; e++; r = parse_fractional_part_u(&e, 6, &add); @@ -528,7 +526,6 @@ static int parse_component_decimal(const char **p, bool usec, int *res) { } } -finish: if (value > INT_MAX) return -ERANGE; @@ -1017,8 +1014,7 @@ fail: return r; } -static int find_end_of_month(struct tm *tm, bool utc, int day) -{ +static int find_end_of_month(struct tm *tm, bool utc, int day) { struct tm t = *tm; t.tm_mon++; |