A bug in uTorrent (which may or may not have been fixed) causes the Added On
and Completed On
dates to be incorrect after a reboot. If you are using fuzzy dates the affected torrents will appear to have been added/completed “less than a minute ago” or if you turned off fuzzy dates, you’ll see that the dates are set in the future.
I’ve written a short ruby script that will correct those dates (more or less) on Windows. I’m sharing this as a GitHub gist for easy downloading.
The error is related to the use of GetTickCount which rolls over every 49.5 days or so. The details of the issue are described in a thread on the uTorrent forums. Even if the bug is fixed in newer versions, anyone who was affected by the issue will not have their mangled dates corrected by upgrading.
Script Explanation
The script works by first looking for all torrents with an added/completed date in the future. For each of those, it looks at all of the files in the torrent. It finds the file with the latest modification time, and it uses that datetime as the value for Completed On
. It uses that file’s creation time at the Added On
value.
Caveats and Info
-
Requires the BEncode Gem:
gem install bencode
-
Ruby doesn’t handle non-ASCII characters all that well (or, I don’t), so when it finds a file name with any non-printable characters, it skips it. If you run this and find the dates aren’t what you were expecting, this may be why.
-
If it cannot find any files that it can use (probably because of the above), then it looks at the date of the folder where the torrent was placed.
-
If all of the folders and files contain non-ASCII characters, it will probably crash or something, I don’t know.
-
This will not run if uTorrent is running.
-
A backup of resume.dat is always taken before anything is modified, and it is placed in the same directory. This file is not deleted automatically.
-
It assumes that all .torrent files are in the same directory as resume.dat (I was not able to find a setting I could read that pointed to a possible alternate location).
-
This script is poorly written, poorly documented, and uses dumb variable names. Running it could corrupt resume.dat, cause baldness, or even give you bad luck.
If you found this helpful, give me a shout!