Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
juga
sbws
Commits
ab52e2c8
Commit
ab52e2c8
authored
May 23, 2018
by
juga
Committed by
Matt Traudt
Jun 05, 2018
Browse files
Replace unix timestamp to ISO in generate bw lines
parent
fc76b4d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
sbws/core/generate.py
View file @
ab52e2c8
from
datetime
import
datetime
from
sbws.globals
import
(
fail_hard
,
is_initted
)
from
sbws.lib.v3bwfile
import
V3BwHeader
from
sbws.lib.resultdump
import
ResultSuccess
from
sbws.lib.resultdump
import
load_recent_results_in_datadir
from
sbws.util.filelock
import
FileLock
from
sbws.util.timestamp
import
unixts_to_isodt_str
,
unixts_to_str
from
argparse
import
ArgumentDefaultsHelpFormatter
from
statistics
import
median
import
os
...
...
@@ -13,8 +12,11 @@ import logging
log
=
logging
.
getLogger
(
__name__
)
# FIXME: move this to v3bwfile?
class
V3BWLine
:
# TODO: docstrings
def
__init__
(
self
,
fp
,
bw
,
nick
,
rtts
,
last_time
):
# TODO: asserts checking arg types
self
.
fp
=
fp
self
.
nick
=
nick
# convert to KiB and make sure the answer is at least 1
...
...
@@ -22,7 +24,7 @@ class V3BWLine:
# convert to ms
rtts
=
[
round
(
r
*
1000
)
for
r
in
rtts
]
self
.
rtt
=
round
(
median
(
rtts
))
self
.
time
=
last_time
self
.
time
=
unixts_to_isodt_str
(
last_time
)
def
__str__
(
self
):
frmt
=
'node_id=${fp} bw={sp} nick={n} rtt={rtt} time={t}'
...
...
Write
Preview
Supports
Markdown
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