Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
d7e74949
Commit
d7e74949
authored
Oct 05, 2001
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix newTimeStamp() so it works when the first arg is not None.
Replace long multiplies with long shifts in U64() and u64().
parent
34ac0dec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
src/ZODB/utils.py
src/ZODB/utils.py
+12
-8
No files found.
src/ZODB/utils.py
View file @
d7e74949
...
@@ -89,26 +89,29 @@ t32 = 1L << 32
...
@@ -89,26 +89,29 @@ t32 = 1L << 32
def
p64
(
v
,
pack
=
struct
.
pack
):
def
p64
(
v
,
pack
=
struct
.
pack
):
"""Pack an integer or long into a 8-byte string"""
"""Pack an integer or long into a 8-byte string"""
if
v
<
t32
:
h
=
0
if
v
<
t32
:
h
=
0
else
:
else
:
h
=
v
/
t32
h
,
v
=
divmod
(
v
,
t32
)
v
=
v
%
t32
return
pack
(
">II"
,
h
,
v
)
return
pack
(
">II"
,
h
,
v
)
def
u64
(
v
,
unpack
=
struct
.
unpack
):
def
u64
(
v
,
unpack
=
struct
.
unpack
):
"""Unpack an 8-byte string into a 64-bit (or long) integer"""
"""Unpack an 8-byte string into a 64-bit (or long) integer"""
# XXX this seems to be just a slower version of U64()
h
,
v
=
unpack
(
">ii"
,
v
)
h
,
v
=
unpack
(
">ii"
,
v
)
if
v
<
0
:
v
=
t32
+
v
if
v
<
0
:
v
=
t32
+
v
if
h
:
if
h
:
if
h
<
0
:
h
=
t32
+
h
if
h
<
0
:
v
=
h
*
t32
+
v
h
=
t32
+
h
v
=
(
h
<<
32
)
+
v
return
v
return
v
def
U64
(
v
,
unpack
=
struct
.
unpack
):
def
U64
(
v
,
unpack
=
struct
.
unpack
):
"""Same as u64 but always returns a long."""
"""Same as u64 but always returns a long."""
h
,
v
=
unpack
(
">II"
,
v
)
h
,
v
=
unpack
(
">II"
,
v
)
if
h
:
if
h
:
v
=
h
*
t32
+
v
v
=
(
h
<<
32
)
+
v
return
v
return
v
def
cp
(
f1
,
f2
,
l
):
def
cp
(
f1
,
f2
,
l
):
...
@@ -129,6 +132,7 @@ def newTimeStamp(old=None,
...
@@ -129,6 +132,7 @@ def newTimeStamp(old=None,
time
=
time
.
time
,
gmtime
=
time
.
gmtime
):
time
=
time
.
time
,
gmtime
=
time
.
gmtime
):
t
=
time
()
t
=
time
()
ts
=
TimeStamp
(
gmtime
(
t
)[:
5
]
+
(
t
%
60
,))
ts
=
TimeStamp
(
gmtime
(
t
)[:
5
]
+
(
t
%
60
,))
if
old
is
not
None
:
return
ts
.
laterThan
(
than
)
if
old
is
not
None
:
return
ts
.
laterThan
(
old
)
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