[net] Subtract timestamps to determine if uploading file changed.
UploadFileElementReader relies on checking the modified time of files being uploaded to determine if a sliced file was modified during upload. Clients of the net stack (in particular Blink) currently pass around the expected modified time in a manner which cause the timestamp to lose precision (E.g. converting to and from a double time_t). As a result the expected timestamp and the current timestamp as returned by GetFileInfo() will not match exactly. Current code attempted to compensate for this by converting both timestamps to (integer) time_t. However, since the conversion rounds down, this check would only succeed if the loss of precision of the expected timestamp also caused it to round down. This is not always the case. (E.g. (epoch + 10.999999) will become 10 when converted to time_t, but the expected timestamp may have rounded up to (epoch + 11.0) in the meantime.) This patch compares the timestamps by checking if the magnitude of the difference is less than one second. BUG=426465 R=mmenke Review URL: https://codereview.chromium.org/868253012 Cr-Commit-Position: refs/heads/master@{#314397}
Showing
Please register or sign in to comment