Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
8486076d
Kaydet (Commit)
8486076d
authored
Mar 26, 2012
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix time.steady(strict=True): don't use CLOCK_REALTIME
üst
3c1e4817
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
+28
-7
timemodule.c
Modules/timemodule.c
+28
-7
No files found.
Modules/timemodule.c
Dosyayı görüntüle @
8486076d
...
...
@@ -779,26 +779,47 @@ steady_clock(int strict)
return
PyFloat_FromDouble
(
secs
);
#elif defined(HAVE_CLOCK_GETTIME)
static
int
clk_index
=
0
;
clockid_t
clk_ids
[]
=
{
static
int
steady_clk_index
=
0
;
static
int
monotonic_clk_index
=
0
;
int
*
clk_index
;
clockid_t
steady_clk_ids
[]
=
{
#ifdef CLOCK_MONOTONIC_RAW
CLOCK_MONOTONIC_RAW
,
#endif
CLOCK_MONOTONIC
,
CLOCK_REALTIME
};
clockid_t
monotonic_clk_ids
[]
=
{
#ifdef CLOCK_MONOTONIC_RAW
CLOCK_MONOTONIC_RAW
,
#endif
CLOCK_MONOTONIC
};
clockid_t
*
clk_ids
;
int
clk_ids_len
;
int
ret
;
struct
timespec
tp
;
while
(
0
<=
clk_index
)
{
clockid_t
clk_id
=
clk_ids
[
clk_index
];
if
(
strict
)
{
clk_index
=
&
monotonic_clk_index
;
clk_ids
=
monotonic_clk_ids
;
clk_ids_len
=
Py_ARRAY_LENGTH
(
monotonic_clk_ids
);
}
else
{
clk_index
=
&
steady_clk_index
;
clk_ids
=
steady_clk_ids
;
clk_ids_len
=
Py_ARRAY_LENGTH
(
steady_clk_ids
);
}
while
(
0
<=
*
clk_index
)
{
clockid_t
clk_id
=
clk_ids
[
*
clk_index
];
ret
=
clock_gettime
(
clk_id
,
&
tp
);
if
(
ret
==
0
)
return
PyFloat_FromDouble
(
tp
.
tv_sec
+
tp
.
tv_nsec
*
1e-9
);
clk_index
++
;
if
(
Py_ARRAY_LENGTH
(
clk_ids
)
<=
clk_index
)
clk_index
=
-
1
;
(
*
clk_index
)
++
;
if
(
clk_ids_len
<=
*
clk_index
)
(
*
clk_index
)
=
-
1
;
}
if
(
strict
)
{
PyErr_SetFromErrno
(
PyExc_OSError
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment