changeset 254:67c8ace9d5f6

Save time strings in UTC time and rotate datafiles at midnight UTC Time strings '05/06/2015 00:00:00.014' in datafiles were reported in Paris local time and the data files were rotated at midnight Paris time. Switch to use UTC time for both.
author Daniele Nicolodi <daniele@grinta.net>
date Fri, 05 Jun 2015 18:06:12 +0200
parents 10bf2bcdbbd4
children ada536bc461b
files FXAnalyse.c
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/FXAnalyse.c	Fri Jun 05 18:01:57 2015 +0200
+++ b/FXAnalyse.c	Fri Jun 05 18:06:12 2015 +0200
@@ -1519,24 +1519,23 @@
 					}
 				}
 
-				// local time
-				struct tm *ltime = localtime(&ev.time.tv_sec);
+				struct tm *time = gmtime(&ev.time.tv_sec);
 				// round to milliseconds
 				int msec = round(ev.time.tv_usec / 1000.0);
 				while (msec >= 1000) {
-					ltime->tm_sec += 1;
+					time->tm_sec += 1;
 					msec -= 1000;
 				}
-				// format local time
+				// format time
 				char timestr[24];
-				int len = strftime(timestr, sizeof(timestr), "%d/%m/%Y %H:%M:%S", ltime);
+				int len = strftime(timestr, sizeof(timestr), "%d/%m/%Y %H:%M:%S", time);
 				snprintf(timestr + len, sizeof(timestr) - len, ".%03d", msec);
 				// display local time
 				SetCtrlVal(MainPanel, PANEL_TIME, timestr);
 				
-				// run id derived from current local date in the form YYMMDD
+				// run id derived from current date in the form YYMMDD
 				char id[7];
-				strftime(id, sizeof(id), "%y%m%d", ltime);
+				strftime(id, sizeof(id), "%y%m%d", time);
 				
 				// write datafiles
 				for (struct datafile *d = datafiles; d->data; d++)