Noticed already many times, now with https://github.com/owncloud/client/pull/5707/files and https://github.com/owncloud/client/pull/5705
It is also nice to give conversion constants etc names with units of measure, rather than putting "magic numbers" in places. e.g. things like
secondsPerHour (instead of magic 3600)
bytesPerKilobyte (instead of magic 1000)
bytesPerKibibyte (instead of magic 1024) https://en.wikipedia.org/wiki/Kibibyte
and so on.
Then calculations can be read "naturally" because names are like:
estimatedHours = estimatedSeconds / secondsPerHour
Or better yet, encode it in the return type.
For time period, we should return std::chrono::milliseconds or std::chrono::seconds
Similarly, for For sizes, we could have an equivalent type for sizes.
Not only this documents exactly the unit in the function signature, but also check at compile time that we do the right conversion
Improved a bit: https://github.com/owncloud/client/pull/6333
Most helpful comment
It is also nice to give conversion constants etc names with units of measure, rather than putting "magic numbers" in places. e.g. things like
secondsPerHour (instead of magic 3600)
bytesPerKilobyte (instead of magic 1000)
bytesPerKibibyte (instead of magic 1024) https://en.wikipedia.org/wiki/Kibibyte
and so on.
Then calculations can be read "naturally" because names are like: