nextbackup icon indicating copy to clipboard operation
nextbackup copied to clipboard

Backup Time defaults to UTC (can't get around it in 10.0.4)

Open dlandon opened this issue 8 years ago • 12 comments

I have had this issue before where the backup file time is UTC. I previously got around this by changing the UTC time in base.php to my local time. Because of the integrity checks in 10.0.4, I can't make this change. How does one set the local time for backups?

dlandon avatar Dec 14 '17 13:12 dlandon

The timestamp that php provides is taken for the backups.

See: https://github.com/pbek/ownbackup/blob/develop/service/backupservice.php#L103

You need to configure the timezones in your server's php.ini. Does that answer your question?

pbek avatar Dec 14 '17 15:12 pbek

echo date_default_timezone_get();

This script outputs 'America/New York' which us my timezone.

The only way I could fix this in previous versions was to set the timezone in base.php.

dlandon avatar Dec 14 '17 16:12 dlandon

I don't know how to help you, ownCloud's own api is used to show the dates: https://github.com/pbek/ownbackup/blob/develop/templates/admin.php#L18

pbek avatar Dec 14 '17 16:12 pbek

I looked into it further and the backup files are dated properly when they are created, but when I go to the ownCloud webgui Settings->Additional, the time stamp on the backup files is shown in UTC.

dlandon avatar Dec 14 '17 23:12 dlandon

the backup files are dated properly when they are created

where did you see that?

pbek avatar Dec 15 '17 05:12 pbek

Here is a listing of the files: drwxr-xr-x 51 abc users 4096 Dec 15 01:00 1513317601 drwxr-xr-x 51 abc users 4096 Dec 15 02:15 1513322101 drwxr-xr-x 51 abc users 4096 Dec 15 03:30 1513326602 drwxr-xr-x 51 abc users 4096 Dec 15 04:45 1513331102 drwxr-xr-x 51 abc users 4096 Dec 15 06:00 1513335601

Here is what the gui shows: ownbackup2

dlandon avatar Dec 15 '17 11:12 dlandon

The gui uses ownCloud's own method to show dates, I've no clue why it doesn't show the desired date for you.

pbek avatar Dec 15 '17 19:12 pbek

Am I the only one that sees this issue?

dlandon avatar Dec 15 '17 19:12 dlandon

Currently I don't know of anyone but you...

pbek avatar Dec 16 '17 04:12 pbek

I ran a short test to determine where the time zone problem is occurring. I placed this code in a timezone.php file in the apps/ownbackup/directory echo date_default_timezone_get();

When I browsed to the file with https://domain/owncloud/apps/ownbackup/timezone.php, the result was my time zone as expected.

When I put this line "echo date_default_timezone_get();" in the backupservice.php, I got the timezone as "UTC". The php.ini timezone is getting lost in the ownbackup app.

dlandon avatar Dec 23 '17 22:12 dlandon

Thank you for your tests. Did the timezone get lost in ownbackup (I would wonder where that would happen) or ownCloud in general?

pbek avatar Dec 24 '17 05:12 pbek

I don't that much about how ownCloud works, but it appears that the timezone set in base.php (UTC) is the default and apps have to determine the local time and adjust. For example, the calendar app has to work in the local time zone. I was told not to change the base.php time zone because ownCloud needs to work in the UTC time zone.

What I did notice is that the file name you use is the UTC time stamp, which is the right way to do it and the file time is adjusted in Linux for the time zone setting. That's why I saw the file time as correct.

dlandon avatar Dec 24 '17 10:12 dlandon