2
# Test of handling time zone with leap seconds.
4
# This test should be run with TZ=:$MYSQL_TEST_DIR/std_data/Moscow_leap
5
# This implies that this test should be run only on systems that interpret
6
# characters after colon in TZ variable as path to zoneinfo file.
8
# Check that we have successfully set time zone with leap seconds.
9
--require r/have_moscow_leap_timezone.require
11
select from_unixtime(1072904422);
16
drop table if exists t1;
20
# Let us check behavior of conversion from broken-down representation
21
# to time_t representation, for normal, non-existent and ambigious dates
22
# (This check is similar to the one in timezone2.test in 4.1)
24
create table t1 (i int, c varchar(20));
25
# Normal value without DST
27
(unix_timestamp("2004-01-01 00:00:00"), "2004-01-01 00:00:00");
28
# Values around and in spring time-gap
30
(unix_timestamp("2004-03-28 01:59:59"), "2004-03-28 01:59:59"),
31
(unix_timestamp("2004-03-28 02:30:00"), "2004-03-28 02:30:00"),
32
(unix_timestamp("2004-03-28 03:00:00"), "2004-03-28 03:00:00");
33
# Normal value with DST
35
(unix_timestamp('2004-05-01 00:00:00'),'2004-05-01 00:00:00');
36
# Ambiguos values (also check for determenism)
38
(unix_timestamp('2004-10-31 01:00:00'),'2004-10-31 01:00:00'),
39
(unix_timestamp('2004-10-31 02:00:00'),'2004-10-31 02:00:00'),
40
(unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59'),
41
(unix_timestamp('2004-10-31 04:00:00'),'2004-10-31 04:00:00'),
42
(unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59');
45
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
46
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
49
(unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'),
50
(unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00');
52
select i, from_unixtime(i), c from t1;
56
# Test for bug #6387 "Queried timestamp values do not match the
57
# inserted". my_gmt_sec() function was not working properly if we
58
# had time zone with leap seconds
60
create table t1 (ts timestamp);
61
insert into t1 values (19730101235900), (20040101235900);
66
# Test Bug #39920: MySQL cannot deal with Leap Second expression in string
70
# 2009-01-01 02:59:59, 2009-01-01 02:59:60 and 2009-01-01 03:00:00
71
SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024);