Revision 26a72a48 lib/utils/text.py
b/lib/utils/text.py | ||
---|---|---|
412 | 412 |
return ", ".join([str(val) for val in names]) |
413 | 413 |
|
414 | 414 |
|
415 |
def FormatTime(val): |
|
415 |
def FormatTime(val, usecs=None):
|
|
416 | 416 |
"""Formats a time value. |
417 | 417 |
|
418 | 418 |
@type val: float or None |
... | ... | |
423 | 423 |
""" |
424 | 424 |
if val is None or not isinstance(val, (int, float)): |
425 | 425 |
return "N/A" |
426 |
|
|
426 | 427 |
# these two codes works on Linux, but they are not guaranteed on all |
427 | 428 |
# platforms |
428 |
return time.strftime("%F %T", time.localtime(val)) |
|
429 |
result = time.strftime("%F %T", time.localtime(val)) |
|
430 |
|
|
431 |
if usecs is not None: |
|
432 |
result += ".%06d" % usecs |
|
433 |
|
|
434 |
return result |
|
429 | 435 |
|
430 | 436 |
|
431 | 437 |
def FormatSeconds(secs): |
Also available in: Unified diff