summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2018-07-09 13:46:10 +0100
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2018-07-12 09:43:00 +0100
commitfae19c94920cff2a7132ed6721f813b923ddbf60 (patch)
tree435b9ea0721907fd36e394c5045e4026681b4a28 /scripts
parent93cf6931b33e2c0f5b89c89b65817fe245ecc391 (diff)
trace.pl: Fix HTML timestamp generation
Now that we scale timestamps to get better timeline granularity, the hacky hand rolled micro-second time to HTML date conversion does no longer cut it. Use perl built-in gmtime to handle things properly. v2: Do not bother with the epoch since timeline times are relative to unknown system boot time. (John Harrison) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: John Harrison <John.C.Harrison@Intel.com> Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/trace.pl15
1 files changed, 4 insertions, 11 deletions
diff --git a/scripts/trace.pl b/scripts/trace.pl
index fd414f5a..fa38e041 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -332,22 +332,15 @@ sub sanitize_ctx
sub ts
{
my ($us) = @_;
- my ($d, $h, $m, $s);
+ my ($y, $mo, $d, $h, $m, $s);
$s = int($us / 1000000);
$us = $us % 1000000;
- $m = int($s / 60);
- $s = $s % 60;
+ ($s, $m, $h, $d, $mo, $y) = gmtime($s);
- $h = int($m / 60);
- $m = $m % 60;
-
- $d = 1 + int($h / 24);
- $h = $h % 24;
-
- return sprintf('2017-01-%02u %02u:%02u:%02u.%06u',
- int($d), int($h), int($m), int($s), int($us));
+ return sprintf('%04u-%02u-%02u %02u:%02u:%02u.%06u',
+ $y, 1 + $mo, $d, $h, $m, $s, int($us));
}
# Main input loop - parse lines and build the internal representation of the