From 7f90df63d1ac659d450a180b50b994a76d5fc7b9 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Wed, 22 Mar 2017 15:32:12 +0100
Subject: [PATCH] Fix time acquisition by adding 'tz' arg

---
 pkg/R/getData.R | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/pkg/R/getData.R b/pkg/R/getData.R
index a4e1e17..9ed0217 100644
--- a/pkg/R/getData.R
+++ b/pkg/R/getData.R
@@ -49,14 +49,16 @@ getData = function(ts_data, exo_data, input_tz="GMT", date_format="%d/%m/%Y %H:%
 			read.csv(ts_data)
 		else
 			ts_data
+	# Convert to the desired timezone (usually "GMT" or "Europe/Paris")
+	formatted_dates_POSIXlt = strptime(as.character(ts_df[,1]), date_format, tz=input_tz)
+	ts_df[,1] = format(as.POSIXct(formatted_dates_POSIXlt, tz=input_tz), tz=working_tz, usetz=TRUE)
+
 	exo_df =
 		if (is.character(exo_data))
 			read.csv(exo_data)
 		else
 			exo_data
-	# Convert to the desired timezone (usually "GMT" or "Europe/Paris")
-	formatted_dates_POSIXlt = strptime(as.character(ts_df[,1]), date_format, tz=input_tz)
-	ts_df[,1] = format(as.POSIXct(formatted_dates_POSIXlt), tz=working_tz, usetz=TRUE)
+	# Times in exogenous variables file are ignored: no conversions required
 
 	line = 1 #index in PM10 file (24 lines for 1 cell)
 	nb_lines = nrow(ts_df)
-- 
2.44.0