You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/07/15 11:25:11 UTC

[GitHub] [incubator-nuttx-apps] FASTSHIFT commented on a diff in pull request #1219: nshlib/nsh_ddcmd: calculate time difference with microsecond precision

FASTSHIFT commented on code in PR #1219:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1219#discussion_r922076297


##########
nshlib/nsh_ddcmd.c:
##########
@@ -353,14 +353,14 @@ 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 * 1000 / (double)elapsed));

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org