Wrong Modification Date for Files on External Storage

We’re using Nextcloud with the external storage app. All users in office use the smb share for work and all users out of office snyc the smb folder via Nextcloud Desktop Client to their PC . The Problem occured when we uploaded thousands of old folders onto the smb share to make these files accessable via nextcloud.

If the original modified date of the file is, let’s say 10.10.2010 10:00 AM then the modified date on the nextcloud web interface is 10.10.2010 09:00 AM. So it’s always got 1 hour in time difference. We’re encountering the same problem when syncing the nextcloud folder of the smb share to another PC using Nextcloud Desktop Client or when accessing the folder via webdav. The weird thing is that this only is the case for a few files. Some of them really do have the correct timestamp.

When the user creates a file on the synced folder (Client), the modified date on the smb share is the time when nextcloud finished syncing.
The “modified date” of a file only matches after users do the following:

  • Edit a file on the client’s synced folder
  • Edit a file on the smb share

We’ve already checked the following:

  • Ubuntu server timezone and local time
  • Deleting, copying or editing multiple faulty files (this resulted in the knowledge above)
  • Check MYSQL time
  • Checked mtime in nextcloud database → table “oc_filecache”
    When converting the mtime value of a faulty file to readable datetime we’re getting the same
    error as opening the file via nextcloud. (1h time difference)

Does anyone have experience with this problem? We guess that this is a problem of nextcloud in combination with smb shares.

We’re grateful for any help. We understand english, as well as german.

System info:
Nextcloud version: 21.0.4
Operating system and version: 20.04.3
Apache or nginx version: 2.4.41
PHP version: 7.4

What timezones are client and server set? It looks a bit as if you told one system to run on a standard local time (without daylight saving) and set it on the local time (with daylight saving) or vice versa, or between samba and Nextcloud (like Nextcloud supposes that samba always uses UTC).

I mostly use UTC on servers and let only the clients run on local timezones.

Questions: Do you only have problems in combination with samba? If you only have this problem on a new file, does it make a difference to put in there via the NC desktop client, NC webinterface or directly via SMB?

I had the same issue. To fix it, I installed php-smbclient package. So Nextcloud use it rather than smbclient. On Debian 11, php7.4-smbclient is not avalaible. I got it from sury repositories and used apt pinning to got just this package from sury.