summaryrefslogtreecommitdiff
path: root/ext/date
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-10-07 14:12:30 +0900
committergit <svn-admin@ruby-lang.org>2022-10-07 14:41:31 +0900
commit1b7c5c394f14e1a7aebbaf14b7d681733d1d97c2 (patch)
tree42c55fdbdf1f0d5d57fa6562f8986487bfe5d4df /ext/date
parentfc218e597709e14634535c5836349f7f89a75dc2 (diff)
[ruby/date] Fix misplaced time zone offset checks
https://github.com/ruby/date/commit/d21c69450a
Diffstat (limited to 'ext/date')
-rw-r--r--ext/date/date_parse.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c
index 7349c75d84..c6f26ecb91 100644
--- a/ext/date/date_parse.c
+++ b/ext/date/date_parse.c
@@ -486,14 +486,14 @@ date_zone_to_diff(VALUE str)
#define out_of_range(v, min, max) ((v) < (min) || (max) < (v))
hour = STRTOUL(s, &p, 10);
if (*p == ':') {
- if (out_of_range(sec, 0, 59)) return Qnil;
+ if (out_of_range(hour, 0, 23)) return Qnil;
s = ++p;
min = STRTOUL(s, &p, 10);
if (out_of_range(min, 0, 59)) return Qnil;
if (*p == ':') {
s = ++p;
sec = STRTOUL(s, &p, 10);
- if (out_of_range(hour, 0, 23)) return Qnil;
+ if (out_of_range(sec, 0, 59)) return Qnil;
}
}
else if (*p == ',' || *p == '.') {