Skip to content

Commit

Permalink
Fixed #1909 -- Return UTC datetime with the POSIX timestamp for API /…
Browse files Browse the repository at this point in the history
…stats/report

Template variable `start_time/end_time` from `time.time(): the time in seconds since the epoch`.

However, script element in `templates/report.html` converts datetime to UTC datetime forcely in `$(".l10n.datetime").html()`

Signed-off-by: Chenyang Yan <memory.yancy@gmail.com>
  • Loading branch information
uddmorningsun committed Oct 27, 2021
1 parent f2f6b9c commit 92fcdc5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions locust/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ def get_html_report(environment, show_download_link=True):
stats = environment.runner.stats

start_ts = stats.start_time
start_time = datetime.datetime.fromtimestamp(start_ts).strftime("%Y-%m-%d %H:%M:%S")
start_time = datetime.datetime.utcfromtimestamp(start_ts).strftime("%Y-%m-%d %H:%M:%S")

end_ts = stats.last_request_timestamp
if end_ts:
end_time = datetime.datetime.fromtimestamp(end_ts).strftime("%Y-%m-%d %H:%M:%S")
end_time = datetime.datetime.utcfromtimestamp(end_ts).strftime("%Y-%m-%d %H:%M:%S")
else:
end_time = start_time

Expand Down

0 comments on commit 92fcdc5

Please sign in to comment.