Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

get_time bug

$
0
0

There appear to be several bugs preventing std::get_time() from working. Specifically using specifiers %p and %X. From what I can tell, the source of the problem is in xloctime::do_get(...)

When I try to use %p, it seems to fail in do_get(...) here:

case 'p':
_Ans = _Getloctxt(_First, _Last, (size_t)0, ":AM:am:PM:pm");
if (_Ans < 0)
_State |= ios_base::failbit;
else
_Pt->tm_hour += _Ans * 12;
break;

The function _Getloctxt does not return 0 or 1 depending on where the input contains AM/am or PM/pm, but returns 0, 1, 2, or 3 for AM, am, PM, or pm, respectively. Is there a fix for this?

I am using Visual Studio Professional 2012 with Update 4.

-Blair Fonville

PS. The bug is easier to spot for %X: the case statement in ::do_get() is missing a "%" in front of the %S specifier.


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>