Okay, a long hiatus after surgery, I’m going to ease back into blogging. Thank you to all who have wished me well.
Those who wished me ill can take solace in the fact that they weren’t completely unsuccessful.
I will be talking about the injury and the hospital and the nursing home and the accessibility issues I now face as a fulltime gimp at home, at my girlfriend’s place, and at work on other days, in other blogs in the future.
For today, I thought I’d cover a question from my email Inbox….
The question I was asked was:
I was using a program that was describing time durations like the ones returned by GetDurationFormat. But for longer time periods, it was describing months and years, and I couldn’t get GetDurationFormat to do that. What’s the secret, what am I missing?
Upon further questioning, he admitted that the program was μTorrent.
I decided not to ask what he was trying to (perhaps illegally!) download.
Or whether it was porn.
Or what porn might take weeks or months to download.
I had in mind reproing it and getting a screenshot, I explained.
He gave me the name of the file and right after I took the screenshot:
I deleted the file and uninstalled μTorrent.
But it proved his point — although I couldn’t get a screenshot of it (it jumped to days too quickly and I didn’t want to keep it downloading any longer than I needed to for the art. Bad enough it was on a work machine!), I did see it saying weeks for a few moments, and I could extrapolate based on the customer report to me that it was probably doing that.
I am reasonably certain that they aren’t using GetDurationFormatEx or its LCID favoring cousin.
Because we never defined any other symbols to use for longer time periods.
They must be rolling their own.
Building on it by taking our function and parsing the results to extend them feels very painful and risky….
But it got me thinking about a few other things.
First of all, some people have way too much free time and free hard drive space!
Second of all, adding these might be a good idea, though it multiplies the risk of grammatical mistakes that even the current function could show with custom format strings that use words (I have seen programs that use it this way).
Third of all, the function only taking a SYSTEMTIME in lpDuration or the 100-nanosecond values in ullDuration is rather awkward. Why not the option of two SYSTEMTIME values as real datetime values to get the duration between? There are lots of usage scenarios where the function would be quite useful but either of the options we give would be quite awkward if not unreasonable. Why make them do so much extra work?
When you get down to it, a duration that is very long becomes awkward very quickly.
Like the title says, it’s not how long it is, it’s how you describe it when it’s long!
I’ll suggest something to the NLS folks (well, I’ll make sure they see this blog!).
It’s good to be back.
Source: MSDN Forum