WinSCP and timestamps
It seems that WinSCP doesn't always set timestamps correctly when editing files on remote machine. As follows are timestamps reported by
stat
command before and after editing a file on a Linux server. I edited the file through WinSCP so that I just right clicked the file and selected 'Edit'.
Before:
Access: 2006-09-27 21:10:35.000000000 +0300
Modify: 2006-09-27 21:10:35.000000000 +0300
Change: 2006-09-27 21:10:35.000000000 +0300
After:
Access: 2006-09-27 20:11:19.000000000 +0300
Modify: 2006-09-27 20:11:19.000000000 +0300
Change: 2006-09-27 21:11:24.000000000 +0300
As you can see the access and modify times have been set into one hour past. Local time was 21:11 both on the server and on my local machine when I edited the file.
This change can be very problematic for example if some other other tool or program uses the modify time to check has the file changed or is it newer that some other file. In my case I've had problems with Jython not recompiling
*.py
files into *.class
files – I sent a mail about that to Jython users mailing list a little time ago and it should be visible in archives soon.
I did some further investigating about this problem and noticed that timestamps issues have been discussed in these forums earlier and that there also is a separate page explaining the issue. More importantly, I also noticed that if I configure WinSCP so that from 'Environment' settings I set 'Daylight saving time' to 'Server adjusts DST' timestamps are set correctly when editing files.
I've thus basically found the solution for my problem but there are few things I wanted to make sure and that's why decided to write this post.
- Have I got the above page correctly and this problem is related to DST?
- Could the problem be related to our configuration? Both the local and remote machine ought to be correctly configured but I'm not 100% sure. What should I check to make it sure configuration is not the problem?
- Assuming that our configuration is correct, is the change in timestamps a WinSCP bug or a feature?
- Assuming that the timestamp change is a feature (i.e. configuration is correct and WinSCP behaving as designed), is the configuration I did (set 'Server adjusts DST' on) correct? With this configuration, will WinSCP work as I expect also when DST changes next time?