Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
persistent
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
persistent
Commits
c98aad18
Commit
c98aad18
authored
May 05, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TimeStamp: sub-second precision for Python implementation of timeTime()
The fractional part of return values was always 0.
parent
aea7889c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
persistent/tests/test_timestamp.py
persistent/tests/test_timestamp.py
+2
-1
persistent/timestamp.py
persistent/timestamp.py
+1
-1
No files found.
persistent/tests/test_timestamp.py
View file @
c98aad18
...
...
@@ -100,9 +100,10 @@ class pyTimeStampTests(unittest.TestCase):
self
.
assertEqual
(
ts
.
timeTime
(),
DELTA_SECS
)
def
test_ctor_from_string_non_zero
(
self
):
before
=
self
.
_makeOne
(
2011
,
2
,
16
,
14
,
37
,
22.
0
)
before
=
self
.
_makeOne
(
2011
,
2
,
16
,
14
,
37
,
22.
80544
)
after
=
self
.
_makeOne
(
before
.
raw
())
self
.
assertEqual
(
before
.
raw
(),
after
.
raw
())
self
.
assertEqual
(
before
.
timeTime
(),
1297867042.80544
)
def
test_ctor_from_elements
(
self
):
from
persistent.timestamp
import
_makeOctets
...
...
persistent/timestamp.py
View file @
c98aad18
...
...
@@ -119,7 +119,7 @@ class pyTimeStamp(object):
""" -> seconds since epoch, as a float.
"""
delta
=
_makeUTC
(
*
self
.
_elements
)
-
_EPOCH
return
delta
.
days
*
86400
.0
+
delta
.
seconds
return
delta
.
days
*
86400
+
delta
.
seconds
+
delta
.
microseconds
/
1e6
def
laterThan
(
self
,
other
):
""" Return a timestamp instance which is later than 'other'.
...
...
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