This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push: new 71ea8b052 nshlib/nsh_ddcmd: calculate time difference with microsecond precision 71ea8b052 is described below commit 71ea8b052dc469b8fca0965a0441f17fb7cb91a0 Author: pengyiqiang <pengyiqi...@xiaomi.com> AuthorDate: Fri Jul 15 16:23:39 2022 +0800 nshlib/nsh_ddcmd: calculate time difference with microsecond precision Signed-off-by: pengyiqiang <pengyiqi...@xiaomi.com> --- nshlib/nsh_ddcmd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nshlib/nsh_ddcmd.c b/nshlib/nsh_ddcmd.c index 0b05860db..288cdcc74 100644 --- a/nshlib/nsh_ddcmd.c +++ b/nshlib/nsh_ddcmd.c @@ -353,14 +353,15 @@ int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) elapsed = (((uint64_t)ts1.tv_sec * NSEC_PER_SEC) + ts1.tv_nsec); elapsed -= (((uint64_t)ts0.tv_sec * NSEC_PER_SEC) + ts0.tv_nsec); - elapsed /= NSEC_PER_MSEC; /* msec */ + elapsed /= NSEC_PER_USEC; /* usec */ total = ((uint64_t)dd.sector * (uint64_t)dd.sectsize); - nsh_output(vtbl, "%llu bytes copied, %u msec, ", + nsh_output(vtbl, "%llu bytes copied, %u usec, ", total, (unsigned int)elapsed); nsh_output(vtbl, "%u KB/s\n" , - (unsigned int)((double)total / (double)elapsed)); + (unsigned int)(((double)total / 1024) + / ((double)elapsed / USEC_PER_SEC))); #endif errout_with_outf: