changeset 612:52980e3a51c7

fc-loadtool: added operation time reporting to flash program-bin
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 24 Feb 2020 21:56:53 +0000
parents c847d742ab38
children ab4021fb1c66
files loadtools/flprogbin.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/loadtools/flprogbin.c	Mon Feb 24 21:44:13 2020 +0000
+++ b/loadtools/flprogbin.c	Mon Feb 24 21:56:53 2020 +0000
@@ -27,7 +27,8 @@
 	char *targv[4], shortarg[10], longarg[513];
 	u_char databuf[256];
 	int reclen, cc, i;
-	time_t curtime, last_time;
+	time_t initial_time, curtime, last_time;
+	unsigned duration, mm, ss;
 
 	if (argc < 4 || argc > 6) {
 inv:		fprintf(stderr,
@@ -139,6 +140,7 @@
 	bytesdone = 0;
 	last_time = 0;
 	crcaccum = 0xFFFFFFFF;
+	time(&initial_time);
 	while (len) {
 		if (len >= 256)
 			reclen = 256;
@@ -179,6 +181,10 @@
 	}
 	putchar('\n');
 	fclose(binf);
+	duration = last_time - initial_time;
+	mm = duration / 60;
+	ss = duration - mm * 60;
+	printf("Operation completed in %um%us\n", mm, ss);
 
 	/* reset flash to read mode */
 	if (bi->ops->reset_cmd(bi) < 0)