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
24b822e2
Kaydet (Commit)
24b822e2
authored
Eyl 02, 2015
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #23517: Try to fix test_time on "x86 Ubuntu Shared 3.x" buildbot
üst
ead144c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
pytime.c
Python/pytime.c
+10
-7
No files found.
Python/pytime.c
Dosyayı görüntüle @
24b822e2
...
@@ -64,11 +64,13 @@ _PyLong_FromTime_t(time_t t)
...
@@ -64,11 +64,13 @@ _PyLong_FromTime_t(time_t t)
static
double
static
double
_PyTime_RoundHalfUp
(
double
x
)
_PyTime_RoundHalfUp
(
double
x
)
{
{
if
(
x
>=
0
.
0
)
/* volatile avoids optimization changing how numbers are rounded */
x
=
floor
(
x
+
0
.
5
);
volatile
double
d
=
x
;
if
(
d
>=
0
.
0
)
d
=
floor
(
d
+
0
.
5
);
else
else
x
=
ceil
(
x
-
0
.
5
);
d
=
ceil
(
d
-
0
.
5
);
return
x
;
return
d
;
}
}
...
@@ -77,7 +79,7 @@ _PyTime_DoubleToDenominator(double d, time_t *sec, long *numerator,
...
@@ -77,7 +79,7 @@ _PyTime_DoubleToDenominator(double d, time_t *sec, long *numerator,
double
denominator
,
_PyTime_round_t
round
)
double
denominator
,
_PyTime_round_t
round
)
{
{
double
intpart
,
err
;
double
intpart
,
err
;
/* volatile avoids
unsafe optimization on float enabled by gcc -O3
*/
/* volatile avoids
optimization changing how numbers are rounded
*/
volatile
double
floatpart
;
volatile
double
floatpart
;
floatpart
=
modf
(
d
,
&
intpart
);
floatpart
=
modf
(
d
,
&
intpart
);
...
@@ -134,7 +136,8 @@ int
...
@@ -134,7 +136,8 @@ int
_PyTime_ObjectToTime_t
(
PyObject
*
obj
,
time_t
*
sec
,
_PyTime_round_t
round
)
_PyTime_ObjectToTime_t
(
PyObject
*
obj
,
time_t
*
sec
,
_PyTime_round_t
round
)
{
{
if
(
PyFloat_Check
(
obj
))
{
if
(
PyFloat_Check
(
obj
))
{
double
d
,
intpart
,
err
;
/* volatile avoids optimization changing how numbers are rounded */
volatile
double
d
,
intpart
,
err
;
d
=
PyFloat_AsDouble
(
obj
);
d
=
PyFloat_AsDouble
(
obj
);
if
(
round
==
_PyTime_ROUND_HALF_UP
)
if
(
round
==
_PyTime_ROUND_HALF_UP
)
...
@@ -255,7 +258,7 @@ static int
...
@@ -255,7 +258,7 @@ static int
_PyTime_FromFloatObject
(
_PyTime_t
*
t
,
double
value
,
_PyTime_round_t
round
,
_PyTime_FromFloatObject
(
_PyTime_t
*
t
,
double
value
,
_PyTime_round_t
round
,
long
to_nanoseconds
)
long
to_nanoseconds
)
{
{
/* volatile avoids
unsafe optimization on float enabled by gcc -O3
*/
/* volatile avoids
optimization changing how numbers are rounded
*/
volatile
double
d
,
err
;
volatile
double
d
,
err
;
/* convert to a number of nanoseconds */
/* convert to a number of nanoseconds */
...
...
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