]> thyrsus.com Git - microjson.git/commitdiff
Remove remnants of t_time.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 26 Sep 2014 15:17:08 +0000 (11:17 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 26 Sep 2014 15:17:08 +0000 (11:17 -0400)
example3.c
microjson.asc

index 6c2c786ee40cd3c28cfdd9cfb034f5a852c00470..e3d94ba239f3a4ca6867b5e751d704084e099f59 100644 (file)
@@ -30,7 +30,6 @@ static int json_devicelist_read(const char *buf)
     const struct json_attr_t json_attrs_subdevice[] = {
        {"path",       t_string,     STRUCTOBJECT(struct devconfig_t, path),
                                        .len = sizeof(devicelist.list[0].path)},
-       {"activated",  t_time,       STRUCTOBJECT(struct devconfig_t, activated)},
        {"activated",  t_real,       STRUCTOBJECT(struct devconfig_t, activated)},
        {NULL},
     };
index 1ba10b4fd31905f678c495cafbe1edd2f2ddc784..2386ae1cfc6b06f60c9fdcd6e2b6049be01d11fb 100644 (file)
@@ -146,10 +146,6 @@ C char buffer.
 +t_character+: Accept a single-character JSON string literal, copy
 that character to a C +char+ location.
 
-+t_time+: Accept a string in the format of an RFC3339 UTC date with
-optional fractional decimal seconds, interpret as seconds since 
-the Unix epoch UTC, store in a C double location..
-
 Associated with each simple value type's storage (in the +addr+
 union) is a correspondingly-named field in the +dflt+ union).
 This is a default value which is copied to the target storage
@@ -284,6 +280,7 @@ array of JSON objects directly into an array of C structs.
 #include <limits.h>
 #include <string.h>
 
+
 #include "mjson.h"
 
 #define MAXUSERDEVS    4
@@ -305,7 +302,6 @@ static int json_devicelist_read(const char *buf)
     const struct json_attr_t json_attrs_subdevice[] = {
        {"path",       t_string,     STRUCTOBJECT(struct devconfig_t, path),
                                        .len = sizeof(devicelist.list[0].path)},
-       {"activated",  t_time,       STRUCTOBJECT(struct devconfig_t, activated)},
        {"activated",  t_real,       STRUCTOBJECT(struct devconfig_t, activated)},
        {NULL},
     };
@@ -345,7 +341,7 @@ Here is an example:
 
 --------------------------------------------------------
 $ example3 '{"devices":[{"path":"/dev/ttyUSB0",
-            "activated":"2014-09-23T10:32:20"}]}'
+            "activated":1411468340}]}'
 1 devices:
 /dev/ttyUSB0 @ 1411468340.000000
 --------------------------------------------------------
@@ -384,9 +380,8 @@ of this in Example 3.)
 
 The dialect this parses has some limitations.  First, it cannot
 recognize the JSON "null" value. Second, all elements of an array must
-be of the same type. Third, some types (t_time, t_character) may not
-be array elements (this restriction could be lifted, and might be 
-in a future release).
+be of the same type. Third, t_character may not be an array element
+(this restriction could be lifted, and might be in a future release).
 
 There are separate entry points for beginning a parse of either JSON
 object or a JSON array.