google / skicka

Command-line utility for working with Google Drive. Join the mailing list at https://groups.google.com/forum/#!forum/skicka-users.
Apache License 2.0
1.3k stars 118 forks source link

Modification time comparison fails on Windows #76

Closed bgrainger closed 9 years ago

bgrainger commented 9 years ago

Google Drive appears to have millisecond resolution for its file modification times, but NTFS supports nanosecond resolution. Thus localTime.Equal(driveTime) in upload.go:559 almost always returns false on NTFS, causing all files to go through an expensive checksum comparison.

Without objection, I will open a PR solving this by rounding all times to the nearest millisecond (i.e., stat.ModTime().UTC().Round(time.Millisecond)).

bgrainger commented 9 years ago

I think Truncate would actually be better (and should match what is implicitly happening in the current code).

mmp commented 9 years ago

Wow, nice find. That sounds like a good fix; I'd be happier taking it as a pull request if you're up for that in that I can't easily test it here, so would be glad to know that the fix actually worked!