On Friday, December 23, 2011 12:02:26 Stewart Gordon wrote: > What is the use case for including a full date in some externally defined > format within a longer formatted date string? ISTM the way to do this is > to define a function that just generates this format straight off. In my > library, toShortFormatString and toLongFormatString are already examples of > this. > > > It also means that you can't reuse letters. > > At the moment only 12 letters are used. I can't see the whole alphabet > being used up any time in the foreseeable future.
It's not that I want to put %ctime and %mpeg7 in the same string. It's that I don't want to have to go define a function for every single one of them. It's a much smaller hit to the API to have flags for them. Another alternative is to supply an enum of format strings for a variety of formats, though that also expands the API a bit (not as badly much though). That may a be better approach for known formats. That doesn't work as well though in cases where the format strings to toCustomString and fromCustomString aren't identical (which happens in the case of mpeg-7, since it uses %cond). So, I don't know. Regardless, I think that the abliity to have more or less arbitrary strings used for flags is valuable. > I think I could expand my scheme to include ISO signed-year notation easily > enough. In the mpeg-7 standard, does the denominator of the fractional > second have to be the smallest possible power of 10, or is F20/1000 or > F0/1000 allowed just as well? If it's 0, there is no fraction, just like there's no decimal if it's 0 for ISO. I don't _think_ that it has to be the smallest possible power of 10, but I don't remember at the moment. I'm going to have to track down the info on the spec again. I'd figured it out for work previously, but unfortunately I lost whatever bookmarks I had with the info. I don't want to shell out money for the spec if I don't have to. Even if I were willing to buy it, it's sold in 12 parts, and I'd probably end up buying several parts before I found the one with the definition of its time format, wasting that much more money. So, I'll have to go digging online again. - Jonathan M Davis
