1 /* adapter_datetime.h - definition for the python date/time types
3 * Copyright (C) 2004 Federico Di Gregorio <fog@debian.org>
5 * This file is part of psycopg.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2,
10 * or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #ifndef PSYCOPG_DATETIME_H
23 #define PSYCOPG_DATETIME_H 1
31 extern PyTypeObject pydatetimeType;
38 #define PSYCO_DATETIME_TIME 0
39 #define PSYCO_DATETIME_DATE 1
40 #define PSYCO_DATETIME_TIMESTAMP 2
41 #define PSYCO_DATETIME_INTERVAL 3
46 /* functions exported to psycopgmodule.c */
47 #ifdef PSYCOPG_DEFAULT_PYDATETIME
49 extern PyObject *psyco_Date(PyObject *module, PyObject *args);
50 #define psyco_Date_doc \
51 "Date(year, month, day) -> new date\n\n" \
52 "Build an object holding a date value."
54 extern PyObject *psyco_Time(PyObject *module, PyObject *args);
55 #define psyco_Time_doc \
56 "Time(hour, minutes, seconds, tzinfo=None) -> new time\n\n" \
57 "Build an object holding a time value."
59 extern PyObject *psyco_Timestamp(PyObject *module, PyObject *args);
60 #define psyco_Timestamp_doc \
61 "Timestamp(year, month, day, hour, minutes, seconds, tzinfo=None) -> new timestamp\n\n" \
62 "Build an object holding a timestamp value."
64 extern PyObject *psyco_DateFromTicks(PyObject *module, PyObject *args);
65 #define psyco_DateFromTicks_doc \
66 "DateFromTicks(ticks) -> new date\n\n" \
67 "Build an object holding a date value from the given ticks value.\n\n" \
68 "Ticks are the number of seconds since the epoch; see the documentation " \
69 "of the standard Python time module for details)."
71 extern PyObject *psyco_TimeFromTicks(PyObject *module, PyObject *args);
72 #define psyco_TimeFromTicks_doc \
73 "TimeFromTicks(ticks) -> new time\n\n" \
74 "Build an object holding a time value from the given ticks value.\n\n" \
75 "Ticks are the number of seconds since the epoch; see the documentation " \
76 "of the standard Python time module for details)."
78 extern PyObject *psyco_TimestampFromTicks(PyObject *module, PyObject *args);
79 #define psyco_TimestampFromTicks_doc \
80 "TimestampFromTicks(ticks) -> new timestamp\n\n" \
81 "Build an object holding a timestamp value from the given ticks value.\n\n" \
82 "Ticks are the number of seconds since the epoch; see the documentation " \
83 "of the standard Python time module for details)."
85 #endif /* PSYCOPG_DEFAULT_PYDATETIME */
87 extern PyObject *psyco_DateFromPy(PyObject *module, PyObject *args);
88 #define psyco_DateFromPy_doc \
89 "DateFromPy(datetime.date) -> new wrapper"
91 extern PyObject *psyco_TimeFromPy(PyObject *module, PyObject *args);
92 #define psyco_TimeFromPy_doc \
93 "TimeFromPy(datetime.time) -> new wrapper"
95 extern PyObject *psyco_TimestampFromPy(PyObject *module, PyObject *args);
96 #define psyco_TimestampFromPy_doc \
97 "TimestampFromPy(datetime.datetime) -> new wrapper"
99 extern PyObject *psyco_IntervalFromPy(PyObject *module, PyObject *args);
100 #define psyco_IntervalFromPy_doc \
101 "IntervalFromPy(datetime.timedelta) -> new wrapper"
107 #endif /* !defined(PSYCOPG_DATETIME_H) */