@@ -103,19 +103,11 @@ _PyFloat_FromPyTime(PyTime_t t)
103
103
}
104
104
105
105
106
- static int
107
- get_system_time (PyTime_t * t )
108
- {
109
- // Avoid _PyTime_TimeUnchecked() which silently ignores errors.
110
- return _PyTime_TimeWithInfo (t , NULL );
111
- }
112
-
113
-
114
106
static PyObject *
115
107
time_time (PyObject * self , PyObject * unused )
116
108
{
117
109
PyTime_t t ;
118
- if (get_system_time (& t ) < 0 ) {
110
+ if (PyTime_Time (& t ) < 0 ) {
119
111
return NULL ;
120
112
}
121
113
return _PyFloat_FromPyTime (t );
@@ -132,7 +124,7 @@ static PyObject *
132
124
time_time_ns (PyObject * self , PyObject * unused )
133
125
{
134
126
PyTime_t t ;
135
- if (get_system_time (& t ) < 0 ) {
127
+ if (PyTime_Time (& t ) < 0 ) {
136
128
return NULL ;
137
129
}
138
130
return _PyTime_AsNanosecondsObject (t );
@@ -1156,19 +1148,11 @@ should not be relied on.");
1156
1148
#endif /* HAVE_WORKING_TZSET */
1157
1149
1158
1150
1159
- static int
1160
- get_monotonic (PyTime_t * t )
1161
- {
1162
- // Avoid _PyTime_MonotonicUnchecked() which silently ignores errors.
1163
- return _PyTime_MonotonicWithInfo (t , NULL );
1164
- }
1165
-
1166
-
1167
1151
static PyObject *
1168
1152
time_monotonic (PyObject * self , PyObject * unused )
1169
1153
{
1170
1154
PyTime_t t ;
1171
- if (get_monotonic (& t ) < 0 ) {
1155
+ if (PyTime_Monotonic (& t ) < 0 ) {
1172
1156
return NULL ;
1173
1157
}
1174
1158
return _PyFloat_FromPyTime (t );
@@ -1183,7 +1167,7 @@ static PyObject *
1183
1167
time_monotonic_ns (PyObject * self , PyObject * unused )
1184
1168
{
1185
1169
PyTime_t t ;
1186
- if (get_monotonic (& t ) < 0 ) {
1170
+ if (PyTime_Monotonic (& t ) < 0 ) {
1187
1171
return NULL ;
1188
1172
}
1189
1173
return _PyTime_AsNanosecondsObject (t );
@@ -1195,19 +1179,11 @@ PyDoc_STRVAR(monotonic_ns_doc,
1195
1179
Monotonic clock, cannot go backward, as nanoseconds." );
1196
1180
1197
1181
1198
- static int
1199
- get_perf_counter (PyTime_t * t )
1200
- {
1201
- // Avoid _PyTime_PerfCounterUnchecked() which silently ignores errors.
1202
- return _PyTime_PerfCounterWithInfo (t , NULL );
1203
- }
1204
-
1205
-
1206
1182
static PyObject *
1207
1183
time_perf_counter (PyObject * self , PyObject * unused )
1208
1184
{
1209
1185
PyTime_t t ;
1210
- if (get_perf_counter (& t ) < 0 ) {
1186
+ if (PyTime_PerfCounter (& t ) < 0 ) {
1211
1187
return NULL ;
1212
1188
}
1213
1189
return _PyFloat_FromPyTime (t );
@@ -1223,7 +1199,7 @@ static PyObject *
1223
1199
time_perf_counter_ns (PyObject * self , PyObject * unused )
1224
1200
{
1225
1201
PyTime_t t ;
1226
- if (get_perf_counter (& t ) < 0 ) {
1202
+ if (PyTime_PerfCounter (& t ) < 0 ) {
1227
1203
return NULL ;
1228
1204
}
1229
1205
return _PyTime_AsNanosecondsObject (t );
0 commit comments