# HG changeset patch # User Daniele Nicolodi # Date 1433520372 -7200 # Node ID 67c8ace9d5f6bcd42e72c23f9b6db1bb228d2aea # Parent 10bf2bcdbbd4f50fe9daec202829ea621f480e4b 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. diff -r 10bf2bcdbbd4 -r 67c8ace9d5f6 FXAnalyse.c --- 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++)