You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/11/24 08:11:44 UTC

[incubator-nuttx-apps] branch master updated (8cde672 -> 747ca59)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git.


    from 8cde672  Fix printf compile warning regarding time_t
     new a875ed2  Revert "Fix printf compile warning regarding time_t"
     new 747ca59  canutils/candump/candump.c: Fix printf formats

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 canutils/candump/candump.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)


[incubator-nuttx-apps] 01/02: Revert "Fix printf compile warning regarding time_t"

Posted by xi...@apache.org.
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

commit a875ed2be725567380087e857dffabb5470363d5
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Tue Nov 24 16:06:05 2020 +0900

    Revert "Fix printf compile warning regarding time_t"
    
    This reverts commit 8cde672b5b8620b8cc0e3dcbc6051907194dacdb.
    
    NuttX's time_t is uint32_t.
    It's wrong to assume it either long or int.
---
 canutils/candump/candump.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/canutils/candump/candump.c b/canutils/candump/candump.c
index fa427c9..4bfa107 100644
--- a/canutils/candump/candump.c
+++ b/canutils/candump/candump.c
@@ -709,7 +709,7 @@ int main(int argc, char **argv)
 
 					/* log CAN frame with absolute timestamp & device */
 					sprint_canframe(buf, &frame, 0, maxdlen);
-					fprintf(logfile, "(%010u.%06ld) %*s %s\n",
+					fprintf(logfile, "(%010ld.%06ld) %*s %s\n",
 						tv.tv_sec, tv.tv_usec,
 						max_devname_len, devname[idx], buf);
 				}
@@ -738,7 +738,7 @@ int main(int argc, char **argv)
 				switch (timestamp) {
 
 				case 'a': /* absolute with timestamp */
-					printf("(%010u.%06ld) ", tv.tv_sec, tv.tv_usec);
+					printf("(%010ld.%06ld) ", tv.tv_sec, tv.tv_usec);
 					break;
 
 				case 'A': /* absolute with date */
@@ -765,7 +765,7 @@ int main(int argc, char **argv)
 						diff.tv_sec--, diff.tv_usec += 1000000;
 					if (diff.tv_sec < 0)
 						diff.tv_sec = diff.tv_usec = 0;
-					printf("(%03u.%06ld) ", diff.tv_sec, diff.tv_usec);
+					printf("(%03ld.%06ld) ", diff.tv_sec, diff.tv_usec);
 				
 					if (timestamp == 'd')
 						last_tv = tv; /* update for delta calculation */


[incubator-nuttx-apps] 02/02: canutils/candump/candump.c: Fix printf formats

Posted by xi...@apache.org.
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

commit 747ca594d66131f9f050bcf142379e130a5c2a2b
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Tue Nov 24 16:09:45 2020 +0900

    canutils/candump/candump.c: Fix printf formats
---
 canutils/candump/candump.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/canutils/candump/candump.c b/canutils/candump/candump.c
index 4bfa107..a166356 100644
--- a/canutils/candump/candump.c
+++ b/canutils/candump/candump.c
@@ -709,8 +709,8 @@ int main(int argc, char **argv)
 
 					/* log CAN frame with absolute timestamp & device */
 					sprint_canframe(buf, &frame, 0, maxdlen);
-					fprintf(logfile, "(%010ld.%06ld) %*s %s\n",
-						tv.tv_sec, tv.tv_usec,
+					fprintf(logfile, "(%010ju.%06ld) %*s %s\n",
+						(uintmax_t)tv.tv_sec, tv.tv_usec,
 						max_devname_len, devname[idx], buf);
 				}
 
@@ -719,8 +719,8 @@ int main(int argc, char **argv)
 
 					/* print CAN frame in log file style to stdout */
 					sprint_canframe(buf, &frame, 0, maxdlen);
-					printf("(%010ld.%06ld) %*s %s\n",
-					       tv.tv_sec, tv.tv_usec,
+					printf("(%010ju.%06ld) %*s %s\n",
+					       (uintmax_t)tv.tv_sec, tv.tv_usec,
 					       max_devname_len, devname[idx], buf);
 					goto out_fflush; /* no other output to stdout */
 				}
@@ -738,7 +738,8 @@ int main(int argc, char **argv)
 				switch (timestamp) {
 
 				case 'a': /* absolute with timestamp */
-					printf("(%010ld.%06ld) ", tv.tv_sec, tv.tv_usec);
+					printf("(%010ju.%06ld) ",
+						   (uintmax_t)tv.tv_sec, tv.tv_usec);
 					break;
 
 				case 'A': /* absolute with date */
@@ -765,7 +766,8 @@ int main(int argc, char **argv)
 						diff.tv_sec--, diff.tv_usec += 1000000;
 					if (diff.tv_sec < 0)
 						diff.tv_sec = diff.tv_usec = 0;
-					printf("(%03ld.%06ld) ", diff.tv_sec, diff.tv_usec);
+					printf("(%03ju.%06ld) ",
+						   (uintmax_t)diff.tv_sec, diff.tv_usec);
 				
 					if (timestamp == 'd')
 						last_tv = tv; /* update for delta calculation */