~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to include/mysql_time.h

  • Committer: Monty Taylor
  • Date: 2008-07-05 22:08:52 UTC
  • mto: This revision was merged to the branch mainline in revision 77.
  • Revision ID: monty@inaugust.com-20080705220852-cqd9t6tfkhvlcf73
Removed HAVE_LONG_LONG, as this is now assumed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2008 MySQL
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; either version 2 of the License, or
9
 
 *  (at your option) any later version.
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
 
#ifndef _libdrizzle_drizzle_time_h
22
 
#define _libdrizzle_drizzle_time_h
 
1
/* Copyright (C) 2004 MySQL AB
 
2
 
 
3
 This program is free software; you can redistribute it and/or modify
 
4
 it under the terms of the GNU General Public License as published by
 
5
 the Free Software Foundation; version 2 of the License.
 
6
 
 
7
 This program is distributed in the hope that it will be useful,
 
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
 GNU General Public License for more details.
 
11
 
 
12
 You should have received a copy of the GNU General Public License
 
13
 along with this program; if not, write to the Free Software
 
14
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
#ifndef _mysql_time_h_
 
17
#define _mysql_time_h_
23
18
 
24
19
/*
25
20
  Time declarations shared between the server and client API:
30
25
  and Time Values" chapter in documentation.
31
26
*/
32
27
 
33
 
enum enum_drizzle_timestamp_type
 
28
enum enum_mysql_timestamp_type
34
29
{
35
 
  DRIZZLE_TIMESTAMP_NONE= -2, DRIZZLE_TIMESTAMP_ERROR= -1,
36
 
  DRIZZLE_TIMESTAMP_DATE= 0, DRIZZLE_TIMESTAMP_DATETIME= 1, DRIZZLE_TIMESTAMP_TIME= 2
 
30
  MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
 
31
  MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
37
32
};
38
33
 
39
34
 
40
35
/*
41
 
  Structure which is used to represent datetime values inside Drizzle.
 
36
  Structure which is used to represent datetime values inside MySQL.
42
37
 
43
38
  We assume that values in this structure are normalized, i.e. year <= 9999,
44
39
  month <= 12, day <= 31, hour <= 23, hour <= 59, hour <= 59. Many functions
45
40
  in server such as my_system_gmt_sec() or make_time() family of functions
46
41
  rely on this (actually now usage of make_*() family relies on a bit weaker
47
 
  restriction). Also functions that produce DRIZZLE_TIME as result ensure this.
 
42
  restriction). Also functions that produce MYSQL_TIME as result ensure this.
48
43
  There is one exception to this rule though if this structure holds time
49
 
  value (time_type == DRIZZLE_TIMESTAMP_TIME) days and hour member can hold
 
44
  value (time_type == MYSQL_TIMESTAMP_TIME) days and hour member can hold
50
45
  bigger values.
51
46
*/
52
 
typedef struct st_drizzle_time
 
47
typedef struct st_mysql_time
53
48
{
54
49
  unsigned int  year, month, day, hour, minute, second;
55
50
  unsigned long second_part;
56
 
  bool       neg;
57
 
  enum enum_drizzle_timestamp_type time_type;
58
 
} DRIZZLE_TIME;
 
51
  my_bool       neg;
 
52
  enum enum_mysql_timestamp_type time_type;
 
53
} MYSQL_TIME;
59
54
 
60
 
#endif /* _libdrizzle_drizzle_time_h */
 
55
#endif /* _mysql_time_h_ */