Skip to content
Advertisement

Error when saving data on a specific date and time

I have a server with Debian 10,Apache/2.4.38, MySQLi, mongodb and Php. The server is running a custom PHP program which allows users to upload their measurements (in .csv files) which are then stored in mongodb.

The uploaded .csv files must comply with a predetermined format in order to be uploaded, like so:

JavaScript

The timestamp must be set every 15 minutes exactly. The code responsible for this check is:

JavaScript

This works fine except one very specific date and time every year. When trying to upload a file starting on 22/02/19 00:15, and ending on 31/12/19 23:45, i get an error:

JavaScript

The above line is the date: 27/10/19 02:45 If i split the file in two different .csv files, the first one with lines 1-23723, and the second one with lines 23725-end, essentially skipping line 23724-date 27/10/19 02:45, the file uploads just fine.

If i try to upload a file with just the three following timesteps:

JavaScript

I get the same error. Same issue appears for 25/10/20 02:45 in the entire 2020 year. Tried many .csv files, same error.

I am trying to understand whether there is something wrong with the OS, the PHP code or the database (mongodb). Any suggestions?

1st EDIT

@Buzz The code that checks the interval should be here:

JavaScript

Mongodb comes in in a different .php file, i believe that the error is in this file.

Advertisement

Answer

The date 27/10/19 02:45 was the date when the timechange occurs. At that time instant PHP adds +3600 seconds to the measurement. Apparently, this only happens to debian installations, it worked without the change on Arch linux. I fixed it by adding:

JavaScript

at the start of the file where the PHP checks the time interval.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement