I was working on this answer. And I ran into a conundrum: scanf
has an assignment suppressing '*'
:
If this option is present, the function does not assign the result of the conversion to any receiving argument
But when used in get_time
the '*'
gives a run-time error on Visual Studio, libc++, and libstdc++: str >> get_time(&tmbuf, "%T.%*Y")
so I believe it's not supported.
As such I chose to ignore input by reading into tmbuf.tm_year
twice:
str >> get_time(&tmbuf, "%H:%M:%S.%Y UTC %b %d %Y");
This works and seems to be my only option so far as get_time
goes since the '*'
isn't accepted. But as we all know, just because it works doesn't mean it's defined. Can someone confirm that:
- It is defined to assign the same variable twice in
get_time
- The stream will always be read left-to-right so the 1stincidence of
%Y
will be stomped, not the 2nd