Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 60cd813

Browse files
committed
Check for HAVE_MKTIME (if you don't have it, some tests will fail, but
at least the build will now succeed). For Sony NEWS-OS, BSD 4.3 based.
1 parent 1809975 commit 60cd813

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Modules/timemodule.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,12 @@ time_strftime(self, args)
321321
buf.tm_mon--;
322322
buf.tm_wday = (buf.tm_wday + 1) % 7;
323323
buf.tm_yday--;
324+
#ifdef HAVE_MKTIME
325+
/* This call is only there to adjust the numbers to be within
326+
bounds. When we don't have mktime(), we say the caller is
327+
responsible for that... */
324328
(void) mktime(&buf);
329+
#endif
325330
/* I hate these functions that presume you know how big the output
326331
* will be ahead of time...
327332
*/
@@ -380,6 +385,7 @@ time_ctime(self, args)
380385
return PyString_FromString(p);
381386
}
382387

388+
#ifdef HAVE_MKTIME
383389
static PyObject *
384390
time_mktime(self, args)
385391
PyObject *self;
@@ -399,6 +405,7 @@ time_mktime(self, args)
399405
}
400406
return PyFloat_FromDouble((double)tt);
401407
}
408+
#endif /* HAVE_MKTIME */
402409

403410
static PyMethodDef time_methods[] = {
404411
{"time", time_time},
@@ -410,7 +417,9 @@ static PyMethodDef time_methods[] = {
410417
{"localtime", time_localtime},
411418
{"asctime", time_asctime},
412419
{"ctime", time_ctime},
420+
#ifdef HAVE_MKTIME
413421
{"mktime", time_mktime},
422+
#endif
414423
#ifdef HAVE_STRFTIME
415424
{"strftime", time_strftime, 1},
416425
#endif

0 commit comments

Comments
 (0)