Commit d259ba40 authored by unknown's avatar unknown
Browse files

Fix for bug #6387 "Queried timestamp values do not match the inserted

value if server runs in time zone with leap seconds".

Now in my_gmt_sec() function we take into account difference between
our target and estimation in seconds part.


mysql-test/Makefile.am:
  Added mysql-test/std_data/Moscow_leap reuired by new timezone3.test
  to source distribution.
sql/time.cc:
  my_gmt_sec():
   When comparing our target broken-down datetime t value and proper 
   representation of our estimation *l_time we should take into account
   that they could differ in second part if we have time zone leap seconds.
   
   Also added comments about some assumptions used in this function.
parent 9c06c80d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ dist-hook:
	$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
	$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.001 $(distdir)/std_data
	$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
	$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data

install-data-local:
	$(mkinstalldirs) \
@@ -50,6 +51,7 @@ install-data-local:
	$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data
	$(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data
	$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data
	$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data

SUFFIXES = .sh

+2 −0
Original line number Diff line number Diff line
from_unixtime(1072904422)
2004-01-01 00:00:00
+41 −0
Original line number Diff line number Diff line
drop table if exists t1;
create table t1 (i int, c varchar(20));
insert into t1 values
(unix_timestamp("2004-01-01 00:00:00"), "2004-01-01 00:00:00");
insert into t1 values
(unix_timestamp("2004-03-28 01:59:59"), "2004-03-28 01:59:59"),
(unix_timestamp("2004-03-28 02:30:00"), "2004-03-28 02:30:00"),
(unix_timestamp("2004-03-28 03:00:00"), "2004-03-28 03:00:00");
insert into t1 values
(unix_timestamp('2004-05-01 00:00:00'),'2004-05-01 00:00:00');
insert into t1 values
(unix_timestamp('2004-10-31 01:00:00'),'2004-10-31 01:00:00'),
(unix_timestamp('2004-10-31 02:00:00'),'2004-10-31 02:00:00'),
(unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59'),
(unix_timestamp('2004-10-31 04:00:00'),'2004-10-31 04:00:00'),
(unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59');
insert into t1 values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
select i, from_unixtime(i), c from t1;
i	from_unixtime(i)	c
1072904422	2004-01-01 00:00:00	2004-01-01 00:00:00
1080428421	2004-03-28 01:59:59	2004-03-28 01:59:59
1080428422	2004-03-28 03:00:00	2004-03-28 02:30:00
1080428422	2004-03-28 03:00:00	2004-03-28 03:00:00
1083355222	2004-05-01 00:00:00	2004-05-01 00:00:00
1099170022	2004-10-31 01:00:00	2004-10-31 01:00:00
1099177222	2004-10-31 02:00:00	2004-10-31 02:00:00
1099180821	2004-10-31 02:59:59	2004-10-31 02:59:59
1099184422	2004-10-31 04:00:00	2004-10-31 04:00:00
1099180821	2004-10-31 02:59:59	2004-10-31 02:59:59
362793608	1981-07-01 03:59:59	1981-07-01 03:59:59
362793610	1981-07-01 04:00:00	1981-07-01 04:00:00
drop table t1;
create table t1 (ts timestamp);
insert into t1 values (19730101235900), (20040101235900);
select * from t1;
ts
19730101235900
20040101235900
drop table t1;
+991 B

File added.

No diff preview for this file type.

+1 −0
Original line number Diff line number Diff line
--timezone=:$MYSQL_TEST_DIR/std_data/Moscow_leap
Loading