File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
codeguru_profiler_agent/utils Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 33import time
44from datetime import datetime
55
6+
67def to_iso (epoch_milli ):
78 try :
8- return datetime .fromtimestamp (epoch_milli / 1000 ).isoformat () + "Z" # ISO 8601 date-time format
9+ return datetime .utcfromtimestamp (epoch_milli / 1000 ).isoformat (
10+ timespec = 'milliseconds' ) + "Z" # ISO 8601 date-time format
911 except ValueError :
1012 return str (epoch_milli )
1113
14+
1215def current_milli_time (clock = time .time ):
1316 return int (clock () * 1000 )
Original file line number Diff line number Diff line change @@ -20,10 +20,10 @@ def test_it_returns_json_with_error_counts(self):
2020 }
2121
2222 def test_it_returns_json_with_agent_start_time (self ):
23- subject = AgentDebugInfo (agent_start_time = 1577869200000 ) # 2020-01-01T01:00:00Z
23+ subject = AgentDebugInfo (agent_start_time = 1577840400000 ) # 2020-01-01T01:00:00Z UTC
2424
2525 serialized_json = subject .serialize_to_json ()
26- assert serialized_json ["agentStartTime" ] == "2020-01-01T01:00:00Z "
26+ assert serialized_json ["agentStartTime" ] == "2020-01-01T01:00:00.000Z "
2727
2828 def test_it_returns_json_with_generic_metrics (self ):
2929 timer = Timer ()
You can’t perform that action at this time.
0 commit comments