1#ifndef COMPAT56_H_INCLUDED
2#define COMPAT56_H_INCLUDED
3/*
4 Copyright (c) 2004, 2012, Oracle and/or its affiliates.
5 Copyright (c) 2013 MariaDB Foundation.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; version 2 of the License.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
19
20
21/** MySQL56 routines and macros **/
22#define MY_PACKED_TIME_GET_INT_PART(x) ((x) >> 24)
23#define MY_PACKED_TIME_GET_FRAC_PART(x) ((x) % (1LL << 24))
24#define MY_PACKED_TIME_MAKE(i, f) ((((longlong) (i)) << 24) + (f))
25#define MY_PACKED_TIME_MAKE_INT(i) ((((longlong) (i)) << 24))
26
27longlong TIME_to_longlong_datetime_packed(const MYSQL_TIME *);
28longlong TIME_to_longlong_time_packed(const MYSQL_TIME *);
29
30void TIME_from_longlong_datetime_packed(MYSQL_TIME *ltime, longlong nr);
31void TIME_from_longlong_time_packed(MYSQL_TIME *ltime, longlong nr);
32
33void my_datetime_packed_to_binary(longlong nr, uchar *ptr, uint dec);
34longlong my_datetime_packed_from_binary(const uchar *ptr, uint dec);
35uint my_datetime_binary_length(uint dec);
36
37void my_time_packed_to_binary(longlong nr, uchar *ptr, uint dec);
38longlong my_time_packed_from_binary(const uchar *ptr, uint dec);
39uint my_time_binary_length(uint dec);
40
41void my_timestamp_to_binary(const struct timeval *tm, uchar *ptr, uint dec);
42void my_timestamp_from_binary(struct timeval *tm, const uchar *ptr, uint dec);
43uint my_timestamp_binary_length(uint dec);
44/** End of MySQL routines and macros **/
45
46#endif /* COMPAT56_H_INCLUDED */
47