[Python-checkins] CVS: python/nondist/sandbox/datetime datetime.c,1.3,1.4 datetime.h,1.2,1.3
Fred L. Drake
fdrake@users.sourceforge.net
2002年3月05日 20:06:01 -0800
Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory usw-pr-cvs1:/tmp/cvs-serv2001
Modified Files:
datetime.c datetime.h
Log Message:
Make the corresponding changes to remove tzoffset support from the datetime
type. Guido made the changes to the Python implementation earlier.
Index: datetime.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** datetime.c 4 Mar 2002 21:20:54 -0000 1.3
--- datetime.c 6 Mar 2002 04:05:59 -0000 1.4
***************
*** 19,23 ****
#define GET_SECOND(o) PyDateTime_GET_SECOND(o)
#define GET_MICROSECOND(o) PyDateTime_GET_MICROSECOND(o)
- #define GET_TZOFFSET(o) PyDateTime_GET_TZOFFSET(o)
/* Set accessors. */
--- 19,22 ----
***************
*** 32,37 ****
((o)->data[8] = ((v) & 0x00ff00) >> 0), \
((o)->data[9] = ((v) & 0x00ff00)))
- #define SET_TZOFFSET(o, v) (((o)->data[10] = ((v) & 0xff00) >> 8), \
- ((o)->data[11] = ((v) & 0x00ff)))
static PyObject *
--- 31,34 ----
***************
*** 87,101 ****
PyDateTime_Object *self = NULL;
long int year, month, day, hour = 0, minute = 0, second = 0, usecond = 0;
- long int tzoffset;
- PyObject *tzoffset_object = Py_None;
static char * keywords[] = {
! "year", "month", "day", "hour", "minute", "second", "microsecond",
! "tzoffset", NULL
};
! if (PyArg_ParseTupleAndKeywords(args, kw, "lll|llllO", keywords,
&year, &month, &day, &hour, &minute,
! &second, &usecond, &tzoffset_object)) {
if (year < MINYEAR || year > MAXYEAR) {
PyErr_SetString(PyExc_ValueError, "year is out of range");
--- 84,95 ----
PyDateTime_Object *self = NULL;
long int year, month, day, hour = 0, minute = 0, second = 0, usecond = 0;
static char * keywords[] = {
! "year", "month", "day", "hour", "minute", "second", "microsecond", NULL
};
! if (PyArg_ParseTupleAndKeywords(args, kw, "lll|llll", keywords,
&year, &month, &day, &hour, &minute,
! &second, &usecond)) {
if (year < MINYEAR || year > MAXYEAR) {
PyErr_SetString(PyExc_ValueError, "year is out of range");
***************
*** 127,147 ****
return NULL;
}
- if (tzoffset_object == Py_None) {
- /* tzoffset == None not yet implemented */
- tzoffset = 0;
- }
- else {
- tzoffset_object = PyNumber_Int(tzoffset_object);
- if (tzoffset_object == NULL)
- return NULL;
- tzoffset = PyInt_AS_LONG(tzoffset_object);
- Py_DECREF(tzoffset_object);
- if (tzoffset < -1439 || tzoffset > 1439) {
- PyErr_SetString(PyExc_ValueError,
- "tzoffset must be in -1439..1439");
- return NULL;
- }
- tzoffset_object = NULL;
- }
self = PyObject_New(PyDateTime_Object, &PyDateTime_Type);
if (self != NULL) {
--- 121,124 ----
***************
*** 153,157 ****
SET_SECOND(self, second);
SET_MICROSECOND(self, usecond);
- SET_TZOFFSET(self, tzoffset);
}
}
--- 130,133 ----
***************
*** 202,211 ****
}
- static PyObject *
- datetime_tzoffset(PyDateTime_Object *self, void *unused)
- {
- return (PyInt_FromLong(GET_TZOFFSET(self)));
- }
-
static PyGetSetDef datetime_getset[] = {
{"year",(getter)datetime_year},
--- 178,181 ----
***************
*** 216,220 ****
{"second", (getter)datetime_second},
{"microsecond", (getter)datetime_microsecond},
- {"tzoffset", (getter)datetime_tzoffset},
{NULL}
};
--- 186,189 ----
Index: datetime.h
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** datetime.h 5 Mar 2002 03:55:35 -0000 1.2
--- datetime.h 6 Mar 2002 04:05:59 -0000 1.3
***************
*** 5,9 ****
#define DATETIME_H
! #define _PyDateTime_DATA_SIZE 12
typedef struct
--- 5,9 ----
#define DATETIME_H
! #define _PyDateTime_DATA_SIZE 10
typedef struct
***************
*** 27,33 ****
| ((PyDateTime_Object*)o)->data[8] << 8\
| ((PyDateTime_Object*)o)->data[9])
- #define PyDateTime_GET_TZOFFSET(o) ((signed int) \
- (((PyDateTime_Object*)o)->data[10] << 8\
- | ((PyDateTime_Object*)o)->data[11]))
#endif
--- 27,30 ----