]> vcs.slashdirt.org Git - sw/tic2json.git/commitdiff

vcs.slashdirt.org Git - sw/tic2json.git/commitdiff

git git / sw / tic2json.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 287f403)
Document ISO 8601 horodates
Tue, 5 Jul 2022 15:23:04 +0000 (17:23 +0200)
Tue, 5 Jul 2022 15:23:04 +0000 (17:23 +0200)

diff --git a/README.md b/README.md
index 716a577d4eeb5228002ae08b610db620f03cacad..9d899494c051d5663473334d4cd980bc265f9725 100644 (file)
--- a/README.md
+++ b/README.md
@@ -93,7 +93,6 @@ Alternatively, using dictionnary output and JSON_v2 parser for TIC "standard" pr
measurement_name = "ticv2"
timestamp_path = "DATE.horodate"
timestamp_format = "rfc3339"
- timestamp_timezone = "Local"
[[inputs.socket_listener.json_v2.object]]
path = "@this"
included_keys = [ "PRM_data", "EAST_data", "IRMS1_data", "URMS1_data", "SINSTS_data", "SMAXSN_data", "UMOY1_data" ]
@@ -113,6 +112,22 @@ Will only log `EAST`, `IRMS1`, `URMS1`, `SINSTS`, `SMAXSN` and `UMOY1`, tagged w
Note: 'socket_listener' expects _exactly_ 1 JSON object per UDP packet (decoding of data is done on a per-packet basis),
hence the need to send each line individually with `nc`. Another alternative is to use the script provided in `tools/ticprocess.py`.
+#### PME-PMI specifics
+
+The PME-PMI meter uses a variant of TIC 01 that does not provide enough date/time information to infer the current DST and adjust the UTC offset in the converted (-r) date output.
+
+In that case, the converted horodate will ommit this offset in the output. The resulting string is still valid ISO 8601 but no longer valid RFC3339.
+
+The following configuration can be used with telegraf's JSON_v2 parser to correctly handle this:
+
+```toml
+ timestamp_path = "DATE.horodate"
+ timestamp_format = "2006年01月02日T15:04:05"
+ timestamp_timezone = "Local"
+```
+
+The timestamps will be logged following the telegraf server timezone which is assumed to be the same as that of the meter (adjust as necessary).
+
## Embedded applications
The following embedded applications are based on this tool
diff --git a/src/tic2json.c b/src/tic2json.c
index d46956be9e04be4ff4e8f90ab42153ff98fdbeed..3cb49ecab878f53cc3f85383e4b314ddd8eefa73 100644 (file)
--- a/src/tic2json.c
+++ b/src/tic2json.c
@@ -252,7 +252,7 @@ void print_field(const struct tic_field *field)
switch (d[0]) {
default:
case ' ':
- o = "";
+ o = ""; // this is not RFC3339-compliant but still valid ISO8601. Does not happen for "DATE" which is normally the timestamp.
break;
case 'E':
case 'e':
@@ -272,7 +272,7 @@ void print_field(const struct tic_field *field)
#endif /* TICV02 */
case V01PME:
#ifdef TICV01pme
- // ticv01pme horodate: JJ/MM/AA HH:MM:SS
+ // ticv01pme horodate: JJ/MM/AA HH:MM:SS - output is valid ISO8601; cannot be RFC339 due to lack of DST info
ticprintf(", \"horodate\": \"20%.2s-%.2s-%.2sT%.2s:%.2s:%.2s\"", d+6, d+3, d, d+9, d+12, d+15);
break;
#endif /* TICV01pme */
@@ -353,7 +353,7 @@ static void usage(void)
" -i id\t\t" "Ajoute une balise \"id\" avec la valeur <id> à chaque groupe\n"
" -l\t\t" "Ajoute les descriptions longues et les unitées de chaque groupe\n"
" -n\t\t" "Insère une nouvelle ligne après chaque groupe\n"
- " -r\t\t" "Interprète les horodates en format RFC3339\n"
+ " -r\t\t" "Interprète les horodates en format RFC3339 (TIC v02) ou ISO8601\n"
" -s N\t\t" "Émet une trame toutes les <N> reçues\n"
" -u\t\t" "Décode le registre de statut sous forme de dictionnaire (TIC v02)\n"
" -V\t\t" "Montre la version et quitte\n"
tic2json TIC parser/converter
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /