Index: Python/import.c =================================================================== --- Python/import.c (Revision 54585) +++ Python/import.c (Arbeitskopie) @@ -21,7 +21,7 @@ extern "C" { #endif -extern time_t PyOS_GetLastModificationTime(char *, FILE *); +extern Py_time_t PyOS_GetLastModificationTime(char *, FILE *); /* In getmtime.c */ /* Magic word to reject .pyc files generated by other Python versions. @@ -721,7 +721,7 @@ Doesn't set an exception. */ static FILE * -check_compiled_module(char *pathname, time_t mtime, char *cpathname) +check_compiled_module(char *pathname, Py_time_t mtime, char *cpathname) { FILE *fp; long magic; @@ -860,7 +860,7 @@ remove the file. */ static void -write_compiled_module(PyCodeObject *co, char *cpathname, time_t mtime) +write_compiled_module(PyCodeObject *co, char *cpathname, Py_time_t mtime) { FILE *fp; @@ -901,7 +901,7 @@ static PyObject * load_source_module(char *name, char *pathname, FILE *fp) { - time_t mtime; + Py_time_t mtime; FILE *fpc; char buf[MAXPATHLEN+1]; char *cpathname; @@ -909,7 +909,7 @@ PyObject *m; mtime = PyOS_GetLastModificationTime(pathname, fp); - if (mtime == (time_t)(-1)) { + if (mtime == (Py_time_t)(-1)) { PyErr_Format(PyExc_RuntimeError, "unable to get modification time from '%s'", pathname); Index: Python/getmtime.c =================================================================== --- Python/getmtime.c (Revision 54585) +++ Python/getmtime.c (Arbeitskopie) @@ -10,7 +10,7 @@ extern "C" { #endif -time_t +Py_time_t PyOS_GetLastModificationTime(char *path, FILE *fp) { struct stat st; Index: Include/pyport.h =================================================================== --- Include/pyport.h (Revision 54585) +++ Include/pyport.h (Arbeitskopie) @@ -218,6 +218,7 @@ #endif /* !HAVE_SYS_TIME_H */ #endif /* !TIME_WITH_SYS_TIME */ +typedef time_t Py_time_t; /****************************** * WRAPPER FOR * Index: Include/timefuncs.h =================================================================== --- Include/timefuncs.h (Revision 54585) +++ Include/timefuncs.h (Arbeitskopie) @@ -10,11 +10,11 @@ #endif -/* Cast double x to time_t, but raise ValueError if x is too large - * to fit in a time_t. ValueError is set on return iff the return - * value is (time_t)-1 and PyErr_Occurred(). +/* Cast double x to Py_time_t, but raise ValueError if x is too large + * to fit in a Py_time_t. ValueError is set on return iff the return + * value is (Py_time_t)-1 and PyErr_Occurred(). */ -PyAPI_FUNC(time_t) _PyTime_DoubleToTimet(double x); +PyAPI_FUNC(Py_time_t) _PyTime_DoubleToTimet(double x); #ifdef __cplusplus Index: RISCOS/unixstuff.h =================================================================== --- RISCOS/unixstuff.h (Revision 54585) +++ RISCOS/unixstuff.h (Arbeitskopie) @@ -6,7 +6,7 @@ int fileno(FILE *f); int isatty(int fn); unsigned int unixtime(unsigned int ld,unsigned int ex); -int acorntime(unsigned int *ex, unsigned int *ld, time_t ut); +int acorntime(unsigned int *ex, unsigned int *ld, Py_time_t ut); int isdir(char *fn); int isfile(char *fn); Index: RISCOS/Modules/riscosmodule.c =================================================================== --- RISCOS/Modules/riscosmodule.c (Revision 54585) +++ RISCOS/Modules/riscosmodule.c (Arbeitskopie) @@ -282,7 +282,7 @@ return riscos_error("can't set date for object with load and exec addresses"); /* convert argument mtime to RISC OS load and exec address */ - if(acorntime(&exec_addr, &load_addr, (time_t) mtime)) + if(acorntime(&exec_addr, &load_addr, (Py_time_t) mtime)) return riscos_oserror(); /* write new load and exec address */ Index: RISCOS/unixstuff.c =================================================================== --- RISCOS/unixstuff.c (Revision 54585) +++ RISCOS/unixstuff.c (Arbeitskopie) @@ -23,7 +23,7 @@ /* from RISC OS infozip, preserves filetype in ld */ -int acorntime(bits *ex, bits *ld, time_t utime) +int acorntime(bits *ex, bits *ld, Py_time_t utime) { unsigned timlo; /* 3 lower bytes of acorn file-time plus carry byte */ unsigned timhi; /* 2 high bytes of acorn file-time */ Index: Modules/datetimemodule.c =================================================================== --- Modules/datetimemodule.c (Revision 54585) +++ Modules/datetimemodule.c (Arbeitskopie) @@ -2241,11 +2241,11 @@ date_local_from_time_t(PyObject *cls, double ts) { struct tm *tm; - time_t t; + Py_time_t t; PyObject *result = NULL; t = _PyTime_DoubleToTimet(ts); - if (t == (time_t)-1 && PyErr_Occurred()) + if (t == (Py_time_t)-1 && PyErr_Occurred()) return NULL; tm = localtime(&t); if (tm) @@ -3623,14 +3623,14 @@ } /* TM_FUNC is the shared type of localtime() and gmtime(). */ -typedef struct tm *(*TM_FUNC)(const time_t *timer); +typedef struct tm *(*TM_FUNC)(const Py_time_t *timer); /* Internal helper. - * Build datetime from a time_t and a distinct count of microseconds. + * Build datetime from a Py_time_t and a distinct count of microseconds. * Pass localtime or gmtime for f, to control the interpretation of timet. */ static PyObject * -datetime_from_timet_and_us(PyObject *cls, TM_FUNC f, time_t timet, int us, +datetime_from_timet_and_us(PyObject *cls, TM_FUNC f, Py_time_t timet, int us, PyObject *tzinfo) { struct tm *tm; @@ -3674,12 +3674,12 @@ datetime_from_timestamp(PyObject *cls, TM_FUNC f, double timestamp, PyObject *tzinfo) { - time_t timet; + Py_time_t timet; double fraction; int us; timet = _PyTime_DoubleToTimet(timestamp); - if (timet == (time_t)-1 && PyErr_Occurred()) + if (timet == (Py_time_t)-1 && PyErr_Occurred()) return NULL; fraction = timestamp - (double)timet; us = (int)round_to_long(fraction * 1e6); Index: Modules/_bsddb.c =================================================================== --- Modules/_bsddb.c (Revision 54585) +++ Modules/_bsddb.c (Arbeitskopie) @@ -4297,12 +4297,12 @@ { int err; long stamp; - time_t timestamp; + Py_time_t timestamp; if (!PyArg_ParseTuple(args, "l:set_tx_timestamp", &stamp)) return NULL; CHECK_ENV_NOT_CLOSED(self); - timestamp = (time_t)stamp; + timestamp = (Py_time_t)stamp; err = self->db_env->set_tx_timestamp(self->db_env, ×tamp); RETURN_IF_ERR(); RETURN_NONE(); Index: Modules/_randommodule.c =================================================================== --- Modules/_randommodule.c (Revision 54585) +++ Modules/_randommodule.c (Arbeitskopie) @@ -221,7 +221,7 @@ return NULL; if (arg == NULL || arg == Py_None) { - time_t now; + Py_time_t now; time(&now); init_genrand(self, (unsigned long)now); Index: Modules/zipimport.c =================================================================== --- Modules/zipimport.c (Revision 54585) +++ Modules/zipimport.c (Arbeitskopie) @@ -883,9 +883,9 @@ in the archive is lower than the mtime stored in a .pyc: we must allow a difference of at most one second. */ static int -eq_mtime(time_t t1, time_t t2) +eq_mtime(Py_time_t t1, Py_time_t t2) { - time_t d = t1 - t2; + Py_time_t d = t1 - t2; if (d < 0) d = -d; /* dostime only stores even seconds, so be lenient */ @@ -898,7 +898,7 @@ to .py if available and we don't want to mask other errors). Returns a new reference. */ static PyObject * -unmarshal_code(char *pathname, PyObject *data, time_t mtime) +unmarshal_code(char *pathname, PyObject *data, Py_time_t mtime) { PyObject *code; char *buf = PyString_AsString(data); @@ -997,7 +997,7 @@ /* Convert the date/time values found in the Zip archive to a value that's compatible with the time stamp stored in .pyc files. */ -static time_t +static Py_time_t parse_dostime(int dostime, int dosdate) { struct tm stm; @@ -1016,11 +1016,11 @@ /* Given a path to a .pyc or .pyo file in the archive, return the modifictaion time of the matching .py file, or 0 if no source is available. */ -static time_t +static Py_time_t get_mtime_of_source(ZipImporter *self, char *path) { PyObject *toc_entry; - time_t mtime = 0; + Py_time_t mtime = 0; Py_ssize_t lastchar = strlen(path) - 1; char savechar = path[lastchar]; path[lastchar] = '\0'; /* strip 'c' or 'o' from *.py[co] */ @@ -1042,7 +1042,7 @@ Zip archive as a new reference. */ static PyObject * get_code_from_data(ZipImporter *self, int ispackage, int isbytecode, - time_t mtime, PyObject *toc_entry) + Py_time_t mtime, PyObject *toc_entry) { PyObject *data, *code; char *modpath; @@ -1094,7 +1094,7 @@ SEP, path); toc_entry = PyDict_GetItemString(self->files, path); if (toc_entry != NULL) { - time_t mtime = 0; + Py_time_t mtime = 0; int ispackage = zso->type & IS_PACKAGE; int isbytecode = zso->type & IS_BYTECODE; Index: Modules/timemodule.c =================================================================== --- Modules/timemodule.c (Revision 54585) +++ Modules/timemodule.c (Arbeitskopie) @@ -99,27 +99,27 @@ static PyObject *moddict; /* Exposed in timefuncs.h. */ -time_t +Py_time_t _PyTime_DoubleToTimet(double x) { - time_t result; + Py_time_t result; double diff; - result = (time_t)x; - /* How much info did we lose? time_t may be an integral or + result = (Py_time_t)x; + /* How much info did we lose? Py_time_t may be an integral or * floating type, and we don't know which. If it's integral, * we don't know whether C truncates, rounds, returns the floor, * etc. If we lost a second or more, the C rounding is - * unreasonable, or the input just doesn't fit in a time_t; + * unreasonable, or the input just doesn't fit in a Py_time_t; * call it an error regardless. Note that the original cast to - * time_t can cause a C error too, but nothing we can do to + * Py_time_t can cause a C error too, but nothing we can do to * worm around that. */ diff = x - (double)result; if (diff <= -1.0 || diff >= 1.0) { PyErr_SetString(PyExc_ValueError, "timestamp out of range for platform time_t"); - result = (time_t)-1; + result = (Py_time_t)-1; } return result; } @@ -265,12 +265,12 @@ } static PyObject * -time_convert(double when, struct tm * (*function)(const time_t *)) +time_convert(double when, struct tm * (*function)(const Py_time_t *)) { struct tm *p; time_t whent = _PyTime_DoubleToTimet(when); - if (whent == (time_t)-1 && PyErr_Occurred()) + if (whent == (Py_time_t)-1 && PyErr_Occurred()) return NULL; errno = 0; p = function(&whent); @@ -397,7 +397,7 @@ return NULL; if (tup == NULL) { - time_t tt = time(NULL); + Py_time_t tt = time(NULL); buf = *localtime(&tt); } else if (!gettmarg(tup, &buf)) return NULL; @@ -539,7 +539,7 @@ if (!PyArg_UnpackTuple(args, "asctime", 0, 1, &tup)) return NULL; if (tup == NULL) { - time_t tt = time(NULL); + Py_time_t tt = time(NULL); buf = *localtime(&tt); } else if (!gettmarg(tup, &buf)) return NULL; @@ -560,7 +560,7 @@ time_ctime(PyObject *self, PyObject *args) { PyObject *ot = NULL; - time_t tt; + Py_time_t tt; char *p; if (!PyArg_UnpackTuple(args, "ctime", 0, 1, &ot)) @@ -572,7 +572,7 @@ if (PyErr_Occurred()) return NULL; tt = _PyTime_DoubleToTimet(dt); - if (tt == (time_t)-1 && PyErr_Occurred()) + if (tt == (Py_time_t)-1 && PyErr_Occurred()) return NULL; } p = ctime(&tt); @@ -597,13 +597,13 @@ time_mktime(PyObject *self, PyObject *tup) { struct tm buf; - time_t tt; + Py_time_t tt; tt = time(&tt); buf = *localtime(&tt); if (!gettmarg(tup, &buf)) return NULL; tt = mktime(&buf); - if (tt == (time_t)(-1)) { + if (tt == (Py_time_t)(-1)) { PyErr_SetString(PyExc_OverflowError, "mktime argument out of range"); return NULL; @@ -693,12 +693,12 @@ #else /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/ #ifdef HAVE_STRUCT_TM_TM_ZONE { -#define YEAR ((time_t)((365 * 24 + 6) * 3600)) - time_t t; +#define YEAR ((Py_time_t)((365 * 24 + 6) * 3600)) + Py_time_t t; struct tm *p; long janzone, julyzone; char janname[10], julyname[10]; - t = (time((time_t *)0) / YEAR) * YEAR; + t = (time((Py_time_t *)0) / YEAR) * YEAR; p = localtime(&t); janzone = -p->tm_gmtoff; strncpy(janname, p->tm_zone ? p->tm_zone : " ", 9); @@ -882,7 +882,7 @@ ftime(&t); return (double)t.time + (double)t.millitm * (double)0.001; #else /* !HAVE_FTIME */ - time_t secs; + Py_time_t secs; time(&secs); return (double)secs; #endif /* !HAVE_FTIME */ Index: Modules/posixmodule.c =================================================================== --- Modules/posixmodule.c (Revision 54585) +++ Modules/posixmodule.c (Arbeitskopie) @@ -1213,7 +1213,7 @@ } static void -fill_time(PyObject *v, int index, time_t sec, unsigned long nsec) +fill_time(PyObject *v, int index, Py_time_t sec, unsigned long nsec) { PyObject *fval,*ival; #if SIZEOF_TIME_T > SIZEOF_LONG @@ -2690,7 +2690,7 @@ #define MTIME buf.modtime #define UTIME_ARG &buf #else /* HAVE_UTIMES */ - time_t buf[2]; + Py_time_t buf[2]; #define ATIME buf[0] #define MTIME buf[1] #define UTIME_ARG buf Index: Modules/xxsubtype.c =================================================================== --- Modules/xxsubtype.c (Revision 54585) +++ Modules/xxsubtype.c (Arbeitskopie) @@ -239,7 +239,7 @@ { PyObject *obj, *name, *res; int n = 1000; - time_t t0, t1; + Py_time_t t0, t1; if (!PyArg_ParseTuple(args, "OS|i", &obj, &name, &n)) return NULL; Index: Modules/_testcapimodule.c =================================================================== --- Modules/_testcapimodule.c (Revision 54585) +++ Modules/_testcapimodule.c (Arbeitskopie) @@ -59,7 +59,7 @@ CHECK_SIZEOF(SIZEOF_INT, int); CHECK_SIZEOF(SIZEOF_LONG, long); CHECK_SIZEOF(SIZEOF_VOID_P, void*); - CHECK_SIZEOF(SIZEOF_TIME_T, time_t); + CHECK_SIZEOF(SIZEOF_TIME_T, Py_time_t); #ifdef HAVE_LONG_LONG CHECK_SIZEOF(SIZEOF_LONG_LONG, PY_LONG_LONG); #endif