From c9766d125af2bedab869e0befce52bd71cdbffb3 Mon Sep 17 00:00:00 2001 From: SPM Date: Fri, 18 Dec 2015 16:09:19 +0100 Subject: [PATCH] Double to str conversion fix Forced en-US locale when converting double to string to ensure that . (dot) is used as delimiter. InfluxDB won't accept anything else than dot regardless on current locale. --- AdysTech.InfluxDB.Client.Net/InfluxDBClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AdysTech.InfluxDB.Client.Net/InfluxDBClient.cs b/AdysTech.InfluxDB.Client.Net/InfluxDBClient.cs index 24c2542..a3082de 100644 --- a/AdysTech.InfluxDB.Client.Net/InfluxDBClient.cs +++ b/AdysTech.InfluxDB.Client.Net/InfluxDBClient.cs @@ -254,7 +254,7 @@ public async Task PostValueAsync(string dbName, string measurement, long t new KeyValuePair("precision", precisionLiterals[(int) precision]) }).ReadAsStringAsync (); - var content = String.Format ("{0},{1} {2}={3} {4}", measurement, tags, field, value, timestamp); + var content = String.Format (System.Globalization.CultureInfo.GetCultureInfo("en-US"), "{0},{1} {2}={3} {4}", measurement, tags, field, value, timestamp); ByteArrayContent requestContent = new ByteArrayContent (Encoding.UTF8.GetBytes (content)); HttpResponseMessage response = await PostAsync (builder, requestContent); @@ -295,7 +295,7 @@ public async Task PostValuesAsync(string dbName, string measurement, long // content.AppendFormat ("{0},{1} {2} {3}\n", measurement, tags, value, timestamp); ////remove last \n //content.Remove (content.Length - 1, 1); - var valuesTxt=String.Join (",", values.Select (v => String.Format ("{0}={1}", v.Key, v.Value))); + var valuesTxt=String.Join (",", values.Select (v => String.Format (System.Globalization.CultureInfo.GetCultureInfo("en-US"), "{0}={1}", v.Key, v.Value))); var content = String.Format ("{0},{1} {2} {3}", measurement, tags, valuesTxt, timestamp); ByteArrayContent requestContent = new ByteArrayContent (Encoding.UTF8.GetBytes (content.ToString ()));