This patch sets LC_NUMERIC variable to "C" to make sure JSON output (as
displayed by mpstat and iostat commads) is locale-independent and
floating-point values use a decimal point.
This should make JSON output compliant with RFC7159.
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
dm_major = get_devmap_major();
}
+ if (DISPLAY_JSON_OUTPUT(flags)) {
+ /* Use a decimal point to make JSON code compliant with RFC7159 */
+ setlocale(LC_NUMERIC, "C");
+ }
+
/* Init structures according to machine architecture */
io_sys_init();
if (group_nr > 0) {
interval = 0;
}
+ if (DISPLAY_JSON_OUTPUT(flags)) {
+ /* Use a decimal point to make JSON code compliant with RFC7159 */
+ setlocale(LC_NUMERIC, "C");
+ }
+
/* Get time */
get_localtime(&(mp_tstamp[0]), 0);