diff options
author | Tim Peters <tim.peters@gmail.com> | 2004-06-20 02:50:16 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2004-06-20 02:50:16 (GMT) |
commit | 1b6f7a9057874ecd2793059f210de87837fe1911 (patch) | |
tree | 950e95d9866258870fc075706b99de3fcfbf2e72 /Include | |
parent | 1c3fa18be76d1bcddb2de516913f46a32c5ed860 (diff) | |
download | cpython-1b6f7a9057874ecd2793059f210de87837fe1911.zip cpython-1b6f7a9057874ecd2793059f210de87837fe1911.tar.gz cpython-1b6f7a9057874ecd2793059f210de87837fe1911.tar.bz2 |
Bug 975996: Add _PyTime_DoubleToTimet to C API
New include file timefuncs.h exports private API function
_PyTime_DoubleToTimet() from timemodule.c. timemodule should export
some other functions too (look for painful bits in datetimemodule.c).
Added insane-argument checking to datetime's assorted fromtimestamp()
and utcfromtimestamp() methods. Added insane-argument tests of these
to test_datetime, and insane-argument tests for ctime(), localtime()
and gmtime() to test_time.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/timefuncs.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Include/timefuncs.h b/Include/timefuncs.h new file mode 100644 index 0000000..553142d --- /dev/null +++ b/Include/timefuncs.h @@ -0,0 +1,23 @@ +/* timefuncs.h + */ + +/* Utility function related to timemodule.c. */ + +#ifndef TIMEFUNCS_H +#define TIMEFUNCS_H +#ifdef __cplusplus +extern "C" { +#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(). + */ +PyAPI_FUNC(time_t) _PyTime_DoubleToTimet(double x); + + +#ifdef __cplusplus +} +#endif +#endif /* TIMEFUNCS_H */ |