helgee / RemoteFiles.jl

Download files from the Internet and keep them up-to-date.
Other
49 stars 8 forks source link

Change the behavior when computing if a file is outdated #26

Closed ronisbr closed 2 years ago

ronisbr commented 2 years ago

Currently, we have the following behaviors given an update interval:

The problem are with files that are updated in those intervals, but at the end of the window. For example, if a file is updated every December 30, then RemoteFiles will download it repeatedly until December 30 of the next year.

This commit treats the intervals relative to the current date of the file. Hence, if the file mtime is December 30, 2021, and the update is set to :yearly, then RemoteFiles will only download a new copy after December 30, 2022. Thus, the new behaviors are:

A problem with this approach exists if the download tool stamps the mtime with the time in which the file was downloaded instead of the time in which the file was modified at the source. However, both curl and wget seems to keep the original time stamp.

I also modified in this commit how the current time is obtained. It uses now(UTC) instead of now() because the file timestamp (obtained with unix2datetime) will always be in UTC.

Closes #25

ronisbr commented 2 years ago

Bump! :)