1
by brian
clean slate |
1 |
#
|
2 |
# Test of SYSTEM time zone handling ( for my_system_gmt_sec()).
|
|
3 |
# This script must be run with TZ=MET
|
|
4 |
||
5 |
-- require r/have_met_timezone.require |
|
6 |
disable_query_log; |
|
7 |
select FROM_UNIXTIME(24*3600); |
|
8 |
enable_query_log; |
|
9 |
||
10 |
# Initialization
|
|
11 |
--disable_warnings |
|
12 |
DROP TABLE IF EXISTS t1; |
|
13 |
--enable_warnings |
|
14 |
||
15 |
# The following is because of daylight saving time
|
|
16 |
--replace_result MEST MET |
|
17 |
show variables like "system_time_zone"; |
|
18 |
||
19 |
#
|
|
20 |
# Test unix timestamp
|
|
21 |
#
|
|
22 |
select @a:=FROM_UNIXTIME(1); |
|
23 |
select unix_timestamp(@a); |
|
24 |
||
25 |
#
|
|
26 |
# Test of some values, including some with daylight saving time
|
|
27 |
#
|
|
28 |
||
29 |
CREATE TABLE t1 (ts int); |
|
30 |
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00')); |
|
31 |
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 02:00')); |
|
32 |
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 03:00')); |
|
33 |
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 02:00')); |
|
34 |
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00')); |
|
35 |
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 02:00')); |
|
36 |
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2003-03-30 02:59:59')); |
|
37 |
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2003-03-30 03:00:00')); |
|
38 |
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2003-03-30 03:59:59')); |
|
39 |
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2003-03-30 04:00:01')); |
|
40 |
||
41 |
SELECT ts,from_unixtime(ts) FROM t1; |
|
42 |
DROP TABLE t1; |
|
43 |
||
44 |
||
45 |
#
|
|
46 |
# Test of warning for spring time-gap values for system time zone
|
|
47 |
#
|
|
48 |
CREATE TABLE t1 (ts timestamp); |
|
49 |
INSERT INTO t1 (ts) VALUES ('2003-03-30 01:59:59'), |
|
50 |
('2003-03-30 02:59:59'), |
|
51 |
('2003-03-30 03:00:00'); |
|
52 |
DROP TABLE t1; |
|
53 |
||
54 |
#
|
|
55 |
# Test for fix for Bug#2523 Check that boundary dates are processed
|
|
56 |
# correctly.
|
|
57 |
#
|
|
58 |
select unix_timestamp('1970-01-01 01:00:00'), |
|
59 |
unix_timestamp('1970-01-01 01:00:01'), |
|
60 |
unix_timestamp('2038-01-19 04:14:07'), |
|
61 |
unix_timestamp('2038-01-19 04:14:08'); |
|
62 |
||
63 |
# End of 4.1 tests
|