2014-11-18 03:11:32 +00:00
|
|
|
extern crate time;
|
|
|
|
|
|
|
|
use self::time::Timespec;
|
|
|
|
use types::test_type;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_tm_params() {
|
|
|
|
fn make_check<'a>(time: &'a str) -> (Option<Timespec>, &'a str) {
|
|
|
|
(Some(time::strptime(time, "'%Y-%m-%d %H:%M:%S.%f'").unwrap().to_timespec()), time)
|
|
|
|
}
|
|
|
|
test_type("TIMESTAMP",
|
2014-11-19 18:20:20 +00:00
|
|
|
&[make_check("'1970-01-01 00:00:00.01'"),
|
2014-11-18 03:11:32 +00:00
|
|
|
make_check("'1965-09-25 11:19:33.100314'"),
|
|
|
|
make_check("'2010-02-09 23:11:45.1202'"),
|
|
|
|
(None, "NULL")]);
|
|
|
|
test_type("TIMESTAMP WITH TIME ZONE",
|
2014-11-19 18:20:20 +00:00
|
|
|
&[make_check("'1970-01-01 00:00:00.01'"),
|
2014-11-18 03:11:32 +00:00
|
|
|
make_check("'1965-09-25 11:19:33.100314'"),
|
|
|
|
make_check("'2010-02-09 23:11:45.1202'"),
|
|
|
|
(None, "NULL")]);
|
|
|
|
}
|
|
|
|
|