Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/python3....
File: pytime.h
#ifndef Py_LIMITED_API
[0] Fix | Delete
#ifndef Py_PYTIME_H
[1] Fix | Delete
#define Py_PYTIME_H
[2] Fix | Delete
[3] Fix | Delete
#include "pyconfig.h" /* include for defines */
[4] Fix | Delete
#include "object.h"
[5] Fix | Delete
[6] Fix | Delete
/**************************************************************************
[7] Fix | Delete
Symbols and macros to supply platform-independent interfaces to time related
[8] Fix | Delete
functions and constants
[9] Fix | Delete
**************************************************************************/
[10] Fix | Delete
#ifdef __cplusplus
[11] Fix | Delete
extern "C" {
[12] Fix | Delete
#endif
[13] Fix | Delete
[14] Fix | Delete
/* _PyTime_t: Python timestamp with subsecond precision. It can be used to
[15] Fix | Delete
store a duration, and so indirectly a date (related to another date, like
[16] Fix | Delete
UNIX epoch). */
[17] Fix | Delete
typedef int64_t _PyTime_t;
[18] Fix | Delete
#define _PyTime_MIN PY_LLONG_MIN
[19] Fix | Delete
#define _PyTime_MAX PY_LLONG_MAX
[20] Fix | Delete
[21] Fix | Delete
typedef enum {
[22] Fix | Delete
/* Round towards minus infinity (-inf).
[23] Fix | Delete
For example, used to read a clock. */
[24] Fix | Delete
_PyTime_ROUND_FLOOR=0,
[25] Fix | Delete
/* Round towards infinity (+inf).
[26] Fix | Delete
For example, used for timeout to wait "at least" N seconds. */
[27] Fix | Delete
_PyTime_ROUND_CEILING=1,
[28] Fix | Delete
/* Round to nearest with ties going to nearest even integer.
[29] Fix | Delete
For example, used to round from a Python float. */
[30] Fix | Delete
_PyTime_ROUND_HALF_EVEN=2,
[31] Fix | Delete
/* Round away from zero
[32] Fix | Delete
For example, used for timeout. _PyTime_ROUND_CEILING rounds
[33] Fix | Delete
-1e-9 to 0 milliseconds which causes bpo-31786 issue.
[34] Fix | Delete
_PyTime_ROUND_UP rounds -1e-9 to -1 millisecond which keeps
[35] Fix | Delete
the timeout sign as expected. select.poll(timeout) must block
[36] Fix | Delete
for negative values." */
[37] Fix | Delete
_PyTime_ROUND_UP=3,
[38] Fix | Delete
/* _PyTime_ROUND_TIMEOUT (an alias for _PyTime_ROUND_UP) should be
[39] Fix | Delete
used for timeouts. */
[40] Fix | Delete
_PyTime_ROUND_TIMEOUT = _PyTime_ROUND_UP
[41] Fix | Delete
} _PyTime_round_t;
[42] Fix | Delete
[43] Fix | Delete
[44] Fix | Delete
/* Convert a time_t to a PyLong. */
[45] Fix | Delete
PyAPI_FUNC(PyObject *) _PyLong_FromTime_t(
[46] Fix | Delete
time_t sec);
[47] Fix | Delete
[48] Fix | Delete
/* Convert a PyLong to a time_t. */
[49] Fix | Delete
PyAPI_FUNC(time_t) _PyLong_AsTime_t(
[50] Fix | Delete
PyObject *obj);
[51] Fix | Delete
[52] Fix | Delete
/* Convert a number of seconds, int or float, to time_t. */
[53] Fix | Delete
PyAPI_FUNC(int) _PyTime_ObjectToTime_t(
[54] Fix | Delete
PyObject *obj,
[55] Fix | Delete
time_t *sec,
[56] Fix | Delete
_PyTime_round_t);
[57] Fix | Delete
[58] Fix | Delete
/* Convert a number of seconds, int or float, to a timeval structure.
[59] Fix | Delete
usec is in the range [0; 999999] and rounded towards zero.
[60] Fix | Delete
For example, -1.2 is converted to (-2, 800000). */
[61] Fix | Delete
PyAPI_FUNC(int) _PyTime_ObjectToTimeval(
[62] Fix | Delete
PyObject *obj,
[63] Fix | Delete
time_t *sec,
[64] Fix | Delete
long *usec,
[65] Fix | Delete
_PyTime_round_t);
[66] Fix | Delete
[67] Fix | Delete
/* Convert a number of seconds, int or float, to a timespec structure.
[68] Fix | Delete
nsec is in the range [0; 999999999] and rounded towards zero.
[69] Fix | Delete
For example, -1.2 is converted to (-2, 800000000). */
[70] Fix | Delete
PyAPI_FUNC(int) _PyTime_ObjectToTimespec(
[71] Fix | Delete
PyObject *obj,
[72] Fix | Delete
time_t *sec,
[73] Fix | Delete
long *nsec,
[74] Fix | Delete
_PyTime_round_t);
[75] Fix | Delete
[76] Fix | Delete
[77] Fix | Delete
/* Create a timestamp from a number of seconds. */
[78] Fix | Delete
PyAPI_FUNC(_PyTime_t) _PyTime_FromSeconds(int seconds);
[79] Fix | Delete
[80] Fix | Delete
/* Macro to create a timestamp from a number of seconds, no integer overflow.
[81] Fix | Delete
Only use the macro for small values, prefer _PyTime_FromSeconds(). */
[82] Fix | Delete
#define _PYTIME_FROMSECONDS(seconds) \
[83] Fix | Delete
((_PyTime_t)(seconds) * (1000 * 1000 * 1000))
[84] Fix | Delete
[85] Fix | Delete
/* Create a timestamp from a number of nanoseconds. */
[86] Fix | Delete
PyAPI_FUNC(_PyTime_t) _PyTime_FromNanoseconds(long long ns);
[87] Fix | Delete
[88] Fix | Delete
/* Convert a number of seconds (Python float or int) to a timetamp.
[89] Fix | Delete
Raise an exception and return -1 on error, return 0 on success. */
[90] Fix | Delete
PyAPI_FUNC(int) _PyTime_FromSecondsObject(_PyTime_t *t,
[91] Fix | Delete
PyObject *obj,
[92] Fix | Delete
_PyTime_round_t round);
[93] Fix | Delete
[94] Fix | Delete
/* Convert a number of milliseconds (Python float or int, 10^-3) to a timetamp.
[95] Fix | Delete
Raise an exception and return -1 on error, return 0 on success. */
[96] Fix | Delete
PyAPI_FUNC(int) _PyTime_FromMillisecondsObject(_PyTime_t *t,
[97] Fix | Delete
PyObject *obj,
[98] Fix | Delete
_PyTime_round_t round);
[99] Fix | Delete
[100] Fix | Delete
/* Convert a timestamp to a number of seconds as a C double. */
[101] Fix | Delete
PyAPI_FUNC(double) _PyTime_AsSecondsDouble(_PyTime_t t);
[102] Fix | Delete
[103] Fix | Delete
/* Convert timestamp to a number of milliseconds (10^-3 seconds). */
[104] Fix | Delete
PyAPI_FUNC(_PyTime_t) _PyTime_AsMilliseconds(_PyTime_t t,
[105] Fix | Delete
_PyTime_round_t round);
[106] Fix | Delete
[107] Fix | Delete
/* Convert timestamp to a number of microseconds (10^-6 seconds). */
[108] Fix | Delete
PyAPI_FUNC(_PyTime_t) _PyTime_AsMicroseconds(_PyTime_t t,
[109] Fix | Delete
_PyTime_round_t round);
[110] Fix | Delete
[111] Fix | Delete
/* Convert timestamp to a number of nanoseconds (10^-9 seconds) as a Python int
[112] Fix | Delete
object. */
[113] Fix | Delete
PyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t);
[114] Fix | Delete
[115] Fix | Delete
/* Convert a timestamp to a timeval structure (microsecond resolution).
[116] Fix | Delete
tv_usec is always positive.
[117] Fix | Delete
Raise an exception and return -1 if the conversion overflowed,
[118] Fix | Delete
return 0 on success. */
[119] Fix | Delete
PyAPI_FUNC(int) _PyTime_AsTimeval(_PyTime_t t,
[120] Fix | Delete
struct timeval *tv,
[121] Fix | Delete
_PyTime_round_t round);
[122] Fix | Delete
[123] Fix | Delete
/* Similar to _PyTime_AsTimeval(), but don't raise an exception on error. */
[124] Fix | Delete
PyAPI_FUNC(int) _PyTime_AsTimeval_noraise(_PyTime_t t,
[125] Fix | Delete
struct timeval *tv,
[126] Fix | Delete
_PyTime_round_t round);
[127] Fix | Delete
[128] Fix | Delete
/* Convert a timestamp to a number of seconds (secs) and microseconds (us).
[129] Fix | Delete
us is always positive. This function is similar to _PyTime_AsTimeval()
[130] Fix | Delete
except that secs is always a time_t type, whereas the timeval structure
[131] Fix | Delete
uses a C long for tv_sec on Windows.
[132] Fix | Delete
Raise an exception and return -1 if the conversion overflowed,
[133] Fix | Delete
return 0 on success. */
[134] Fix | Delete
PyAPI_FUNC(int) _PyTime_AsTimevalTime_t(
[135] Fix | Delete
_PyTime_t t,
[136] Fix | Delete
time_t *secs,
[137] Fix | Delete
int *us,
[138] Fix | Delete
_PyTime_round_t round);
[139] Fix | Delete
[140] Fix | Delete
#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE)
[141] Fix | Delete
/* Convert a timestamp to a timespec structure (nanosecond resolution).
[142] Fix | Delete
tv_nsec is always positive.
[143] Fix | Delete
Raise an exception and return -1 on error, return 0 on success. */
[144] Fix | Delete
PyAPI_FUNC(int) _PyTime_AsTimespec(_PyTime_t t, struct timespec *ts);
[145] Fix | Delete
#endif
[146] Fix | Delete
[147] Fix | Delete
/* Get the current time from the system clock.
[148] Fix | Delete
[149] Fix | Delete
The function cannot fail. _PyTime_Init() ensures that the system clock
[150] Fix | Delete
works. */
[151] Fix | Delete
PyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(void);
[152] Fix | Delete
[153] Fix | Delete
/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards.
[154] Fix | Delete
The clock is not affected by system clock updates. The reference point of
[155] Fix | Delete
the returned value is undefined, so that only the difference between the
[156] Fix | Delete
results of consecutive calls is valid.
[157] Fix | Delete
[158] Fix | Delete
The function cannot fail. _PyTime_Init() ensures that a monotonic clock
[159] Fix | Delete
is available and works. */
[160] Fix | Delete
PyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void);
[161] Fix | Delete
[162] Fix | Delete
[163] Fix | Delete
/* Structure used by time.get_clock_info() */
[164] Fix | Delete
typedef struct {
[165] Fix | Delete
const char *implementation;
[166] Fix | Delete
int monotonic;
[167] Fix | Delete
int adjustable;
[168] Fix | Delete
double resolution;
[169] Fix | Delete
} _Py_clock_info_t;
[170] Fix | Delete
[171] Fix | Delete
/* Get the current time from the system clock.
[172] Fix | Delete
* Fill clock information if info is not NULL.
[173] Fix | Delete
* Raise an exception and return -1 on error, return 0 on success.
[174] Fix | Delete
*/
[175] Fix | Delete
PyAPI_FUNC(int) _PyTime_GetSystemClockWithInfo(
[176] Fix | Delete
_PyTime_t *t,
[177] Fix | Delete
_Py_clock_info_t *info);
[178] Fix | Delete
[179] Fix | Delete
/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards.
[180] Fix | Delete
The clock is not affected by system clock updates. The reference point of
[181] Fix | Delete
the returned value is undefined, so that only the difference between the
[182] Fix | Delete
results of consecutive calls is valid.
[183] Fix | Delete
[184] Fix | Delete
Fill info (if set) with information of the function used to get the time.
[185] Fix | Delete
[186] Fix | Delete
Return 0 on success, raise an exception and return -1 on error. */
[187] Fix | Delete
PyAPI_FUNC(int) _PyTime_GetMonotonicClockWithInfo(
[188] Fix | Delete
_PyTime_t *t,
[189] Fix | Delete
_Py_clock_info_t *info);
[190] Fix | Delete
[191] Fix | Delete
[192] Fix | Delete
/* Initialize time.
[193] Fix | Delete
Return 0 on success, raise an exception and return -1 on error. */
[194] Fix | Delete
PyAPI_FUNC(int) _PyTime_Init(void);
[195] Fix | Delete
[196] Fix | Delete
/* Converts a timestamp to the Gregorian time, using the local time zone.
[197] Fix | Delete
Return 0 on success, raise an exception and return -1 on error. */
[198] Fix | Delete
PyAPI_FUNC(int) _PyTime_localtime(time_t t, struct tm *tm);
[199] Fix | Delete
[200] Fix | Delete
/* Converts a timestamp to the Gregorian time, assuming UTC.
[201] Fix | Delete
Return 0 on success, raise an exception and return -1 on error. */
[202] Fix | Delete
PyAPI_FUNC(int) _PyTime_gmtime(time_t t, struct tm *tm);
[203] Fix | Delete
[204] Fix | Delete
#ifdef __cplusplus
[205] Fix | Delete
}
[206] Fix | Delete
#endif
[207] Fix | Delete
[208] Fix | Delete
#endif /* Py_PYTIME_H */
[209] Fix | Delete
#endif /* Py_LIMITED_API */
[210] Fix | Delete
[211] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function