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
7a1c7918
Kaydet (Commit)
7a1c7918
authored
Tem 21, 1996
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add mac compatibility
üst
024a387f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
1 deletion
+29
-1
rpc.py
Demo/rpc/rpc.py
+29
-1
No files found.
Demo/rpc/rpc.py
Dosyayı görüntüle @
7a1c7918
...
...
@@ -163,9 +163,37 @@ def make_auth_unix_default():
except
ImportError
:
uid
=
gid
=
0
import
time
return
make_auth_unix
(
int
(
time
.
time
()),
\
return
make_auth_unix
(
int
(
time
.
time
()
-
unix_epoch
()
),
\
socket
.
gethostname
(),
uid
,
gid
,
[])
_unix_epoch
=
-
1
def
unix_epoch
():
"""Very painful calculation of when the Unix Epoch is.
This is defined as the return value of time.time() on Jan 1st,
1970, 00:00:00 GMT.
On a Unix system, this should always return 0.0. On a Mac, the
calculations are needed -- and hard because of integer overflow
and other limitations.
"""
global
_unix_epoch
if
_unix_epoch
>=
0
:
return
_unix_epoch
import
time
now
=
time
.
time
()
localt
=
time
.
localtime
(
now
)
# (y, m, d, hh, mm, ss, ..., ..., ...)
gmt
=
time
.
gmtime
(
now
)
offset
=
time
.
mktime
(
localt
)
-
time
.
mktime
(
gmt
)
y
,
m
,
d
,
hh
,
mm
,
ss
=
1970
,
1
,
1
,
0
,
0
,
0
offset
,
ss
=
divmod
(
ss
+
offset
,
60
)
offset
,
mm
=
divmod
(
mm
+
offset
,
60
)
offset
,
hh
=
divmod
(
hh
+
offset
,
24
)
d
=
d
+
offset
_unix_epoch
=
time
.
mktime
((
y
,
m
,
d
,
hh
,
mm
,
ss
,
0
,
0
,
0
))
print
"Unix epoch:"
,
time
.
ctime
(
_unix_epoch
)
return
_unix_epoch
# Common base class for clients
...
...
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