diff options
author | Tor Didriksen <tor.didriksen@sun.com> | 2010-05-19 11:18:59 +0200 |
---|---|---|
committer | Tor Didriksen <tor.didriksen@sun.com> | 2010-05-19 11:18:59 +0200 |
commit | a22c69b233e6dd027a3488feb2f5b909ca5681b1 (patch) | |
tree | 1ccb73398b1613c6e54918ef0e8268dad1c178bb /sql/event_data_objects.cc | |
parent | f512cb4eaf0fbbf8cfa0444189da94f0215d8c5c (diff) | |
download | mariadb-git-a22c69b233e6dd027a3488feb2f5b909ca5681b1.tar.gz |
Backport from next-mr-bugfixing of tor.didriksen@sun.com-20100106140051-3j2iuag63eltsr2e
Bug #50087 Interval arithmetic for Event_queue_element is not portable.
Subtraction of two unsigned months yielded a (very large) positive value.
Conversion of this to a signed value was not necessarily well defined.
Solution: do the subtraction on signed values.
Diffstat (limited to 'sql/event_data_objects.cc')
-rw-r--r-- | sql/event_data_objects.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index 92e237a17b7..0218092c4c7 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -834,8 +834,9 @@ bool get_next_time(const Time_zone *time_zone, my_time_t *next, } else { - long diff_months= (long) (local_now.year - local_start.year)*12 + - (local_now.month - local_start.month); + long diff_months= ((long) local_now.year - (long) local_start.year)*12 + + ((long) local_now.month - (long) local_start.month); + /* Unlike for seconds above, the formula below returns the interval that, when added to the local_start, will give the time in the |