mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [47/50] [abbrv] incubator-mynewt-core git commit: MYNEWT-696 NMP datetime: always put usecs in rsp.
Date Wed, 26 Apr 2017 22:41:35 GMT
MYNEWT-696 NMP datetime: always put usecs in rsp.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/6ac1b82e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/6ac1b82e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/6ac1b82e

Branch: refs/heads/bluetooth5
Commit: 6ac1b82ef24fc45adb742e4fa872204faa4ea410
Parents: 5ec317d
Author: Christopher Collins <ccollins@apache.org>
Authored: Tue Apr 25 18:27:52 2017 -0700
Committer: Christopher Collins <ccollins@apache.org>
Committed: Tue Apr 25 18:27:52 2017 -0700

----------------------------------------------------------------------
 time/datetime/src/datetime.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6ac1b82e/time/datetime/src/datetime.c
----------------------------------------------------------------------
diff --git a/time/datetime/src/datetime.c b/time/datetime/src/datetime.c
index 229866a..31a3641 100644
--- a/time/datetime/src/datetime.c
+++ b/time/datetime/src/datetime.c
@@ -379,23 +379,14 @@ datetime_format(const struct os_timeval *tv, const struct os_timezone
*tz,
     cp = ostr;
     rlen = olen;
 
-    rc = snprintf(cp, rlen, "%04d-%02d-%02dT%02d:%02d:%02d",
-        ct.year, ct.mon, ct.day, ct.hour, ct.min, ct.sec);
+    rc = snprintf(cp, rlen, "%04d-%02d-%02dT%02d:%02d:%02d.%06d",
+        ct.year, ct.mon, ct.day, ct.hour, ct.min, ct.sec, ct.usec);
     cp += rc;
     rlen -= rc;
     if (rc < 0 || rlen <= 0) {
         goto err;
     }
 
-    if (ct.usec != 0) {
-        rc = snprintf(cp, rlen, ".%06d", ct.usec);
-        cp += rc;
-        rlen -= rc;
-        if (rc < 0 || rlen <= 0) {
-            goto err;
-        }
-    }
-
     if (tz != NULL) {
         minswest = tz->tz_minuteswest;
         if (tz->tz_dsttime) {


Mime
View raw message