Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"hms" format timestamps have extra zero padding in milliseconds #22

Open
GoogleCodeExporter opened this issue Mar 17, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

Run tsreport -b -tafmt hms tfmt hms file.ts

Note that the timestamps are actually hh:mm:ss.0nnn where nnn is the 
milliseconds, making the milliseconds part appear only one tenth of what it 
should be, 

Here's a very small diff which corrects this:

diff --git a/fmtx.c b/fmtx.c
index dd250b6..b8c30b5 100644
--- a/fmtx.c
+++ b/fmtx.c
@@ -93,7 +93,7 @@ const TCHAR *fmtx_timestamp(int64_t n, unsigned int flags)
       a27 /= I64K(60);
       m = (unsigned int)(a27 % I64K(60));
       h = (unsigned int)(a27 / I64K(60));
-      _stprintf(buf, _T("%s%u:%02u:%02u.%04u"), n27 < 0 ? _T("-") : _T(""), h, 
m, s, f/1000);
+      _stprintf(buf, _T("%s%u:%02u:%02u.%03u"), n27 < 0 ? _T("-") : _T(""), h, 
m, s, f/1000);
       break;
     }


Original issue reported on code.google.com by piers.sc...@ericsson.com on 4 Mar 2013 at 5:30

@GoogleCodeExporter
Copy link
Author

An updated diff following changes to the trunk. (This is a really simple fix 
and obvious bug - surprised it's not been incorporated already.)

diff --git a/fmtx.c b/fmtx.c
index c0fd4a0..22101ea 100644
--- a/fmtx.c
+++ b/fmtx.c
@@ -93,7 +93,7 @@ const TCHAR *fmtx_timestamp(int64_t n, unsigned int flags)
       a27 /= I64K(60);
       m = (unsigned int)(a27 % I64K(60));
       h = (unsigned int)(a27 / I64K(60));
-      _sntprintf(buf, FMTX_BUFFER_SIZE, _T("%s%u:%02u:%02u.%04u"), n27 < 0 ? 
_T("-") : _T(""), h, m, s, f/1000);
+      _sntprintf(buf, FMTX_BUFFER_SIZE, _T("%s%u:%02u:%02u.%03u"), n27 < 0 ? 
_T("-") : _T(""), h, m, s, f/1000);
       break;
     }

Original comment by piers.sc...@ericsson.com on 29 Jul 2013 at 10:30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant